package cn.com.headfree.drafts.dao.impl;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.com.headfree.entity.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import com.gta.edu.sdk.common.dto.Page;
import com.gta.edu.sdk.util.IdGen;
import com.gta.edu.sdk.util.StringUtil;

import cn.com.headfree.drafts.dao.IDraftsDao;
import cn.com.headfree.entity.isc.User;
import cn.com.headfree.vo.EachTypeDetailVo;
import cn.com.headfree.vo.IntegrityAnalysisVo;
import cn.com.headfree.vo.SysDictionaryInfoVo;
import cn.com.headfree.vo.complex.TAcadeAchiveInfoVo;
import cn.com.headfree.vo.complex.TPatentInfoVo;
import cn.com.headfree.vo.complex.TProjAchieveInfoVo;
import cn.com.headfree.vo.complex.TStandInfoVo;
import cn.com.headfree.vo.complex.TTecInnovInfoVo;
import cn.com.headfree.vo.complex.TTecManInnovVo;
import cn.com.headfree.vo.drafts.DraftsListVo;

@Repository("draftsDao")
public class DraftsDaoImpl extends BaseDaoImpl<TMouldInfo> implements IDraftsDao {

	@Override
	public void addBaseInfo(TEmpBaseInfo baseInfo) {
		String sql = "insert into t_emp_base_info_drafts (id,erp_no,name,sex,birth_date,nation,birth_place,born_place,politi_status,id_card_no,mobile_phone,level,salary_grade,party_date,job_date,unit,dept,cur_post,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},")
				.append("#{name,jdbcType=VARCHAR},").append("#{sex,jdbcType=VARCHAR},")
				.append("#{birth_date,jdbcType=DATE},").append("#{nation,jdbcType=VARCHAR},")
				.append("#{birth_place,jdbcType=VARCHAR},").append("#{born_place,jdbcType=VARCHAR},").append("#{politi_status,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{mobile_phone,jdbcType=VARCHAR},")
				.append("#{level,jdbcType=VARCHAR},").append("#{salary_grade,jdbcType=VARCHAR},")
				.append("#{party_date,jdbcType=DATE},").append("#{job_date,jdbcType=DATE},")
				.append("#{unit,jdbcType=VARCHAR},").append("#{dept,jdbcType=VARCHAR},")
				.append("#{cur_post,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
		        .append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", baseInfo.getId());
		params.put("erp_no", baseInfo.getErpNo());
		params.put("name", baseInfo.getName());
		params.put("sex", baseInfo.getSex());
		params.put("birth_date", baseInfo.getBirthDate());
		params.put("nation", baseInfo.getNation());
		params.put("birth_place", baseInfo.getBirthPlace());
		params.put("born_place", baseInfo.getBornPlace());
		params.put("politi_status", baseInfo.getPolitiStatus());
		params.put("id_card_no", baseInfo.getIdCardNo());
		params.put("mobile_phone", baseInfo.getMobilePhone());
		params.put("level", baseInfo.getLevel());
		params.put("salary_grade", baseInfo.getSalaryGrade());
		params.put("party_date", baseInfo.getPartyDate());
		params.put("job_date", baseInfo.getJobDate());
		params.put("unit", baseInfo.getUnit());
		params.put("dept", baseInfo.getDept());
		params.put("cur_post", baseInfo.getCurPost());
		params.put("creater_id", baseInfo.getCreaterId());
		params.put("creater_name", baseInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", baseInfo.getUpdaterId());
		params.put("updater_name", baseInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", baseInfo.getDelSign());
		params.put("is_valid", baseInfo.getIsValid());
		params.put("audit_state", baseInfo.getAuditState());
		params.put("orignal_id", baseInfo.getOrignalId());
		params.put("flow_status",baseInfo.getFlowStatus());
		params.put("business_type_id",baseInfo.getBusinessTypeId());
		params.put("isc_user_id",baseInfo.getIscUserId());
		params.put("primitive_id",baseInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TEmpBaseInfo getBaseInfoById(String id) {
		String sql = //" select id,erp_no,name,sex,GET_DIC('Gender',sex) as sex_name,birth_date,nation, " +
				" select t.*," +
				" GET_DIC('Gender',sex) as sex_name, " +
				" GET_DIC('Nation',nation) as nation_name,id_card_no,politi_status, " +
				" GET_DIC('PoliticalLandscapeText',politi_status) as politi_status_name, " +
				" mobile_phone,level,salary_grade,party_date,job_date,cur_post from t_emp_base_info_drafts t where t.id = ? and t.del_sign = '0' ";
		return this.findUnique(TEmpBaseInfo.class, sql, new Object[] { id });
	}

	@Override
	public TEmpBaseInfo getBaseInfoByErpNo(String erpNo) {
		String sql = //" select id,erp_no,name,sex,GET_DIC('Gender',sex) as sex_name,birth_date,nation, " +
				" select t.*," +
				" GET_DIC('Nation',nation) as nation_name,id_card_no,politi_status, " +
                " GET_DIC('Gender',sex) as sex_name, " +
                " GET_DIC('PoliticalLandscapeText',politi_status) as politi_status_name, " +
                " mobile_phone,level,salary_grade,party_date,job_date,cur_post from t_educate_info_drafts t where t.erp_no= ?  and  t.is_valid='1' and t.del_sign = '0' ";
		return this.findUnique(TEmpBaseInfo.class, sql, new Object[] { erpNo });
	}

	@Override
	public void addYearEffect(TYearEffectInfo yearEffectInfo) {
		String sql = "insert into t_year_effect_info_drafts (id,erp_no,user_name,id_card_no,rate_year_start,rate_year_end,rate_year,perfor_grade,resi_inte,cur_inte,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{rate_year_start,jdbcType=DATE},")
				.append("#{rate_year_end,jdbcType=DATE},").append("#{rate_year,jdbcType=INTEGER},").append("#{perfor_grade,jdbcType=VARCHAR},")
				.append("#{resi_inte,jdbcType=DOUBLE},").append("#{cur_inte,jdbcType=DOUBLE},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", yearEffectInfo.getId());
		params.put("erp_no", yearEffectInfo.getErpNo());
		params.put("user_name", yearEffectInfo.getUserName());
		params.put("id_card_no", yearEffectInfo.getIdCardNo());
		params.put("rate_year_start", yearEffectInfo.getRateYearStart());
		params.put("rate_year_end", yearEffectInfo.getRateYearEnd());
		params.put("rate_year", yearEffectInfo.getRateYear());
		params.put("perfor_grade", yearEffectInfo.getPerforGrade());
		params.put("resi_inte", yearEffectInfo.getResiInte());
		params.put("cur_inte", yearEffectInfo.getCurInte());
		params.put("creater_id", yearEffectInfo.getCreaterId());
		params.put("creater_name", yearEffectInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", yearEffectInfo.getUpdaterId());
		params.put("updater_name", yearEffectInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", yearEffectInfo.getDelSign());
		params.put("is_valid", yearEffectInfo.getIsValid());
		params.put("audit_state", yearEffectInfo.getAuditState());
		params.put("orignal_id", yearEffectInfo.getOrignalId());
		params.put("flow_status",yearEffectInfo.getFlowStatus());
		params.put("business_type_id",yearEffectInfo.getBusinessTypeId());
		params.put("isc_user_id",yearEffectInfo.getIscUserId());
		params.put("primitive_id",yearEffectInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TYearEffectInfo getYearEffectById(String id) {
		String sql = " select t.*,GET_DIC('PerformLevelRecentThreeYears',perfor_grade) as perfor_grade_name " +
				" from t_year_effect_info_drafts t  where t.id= ? and t.del_sign = '0'  ";
		return this.findUnique(TYearEffectInfo.class, sql, new Object[] { id });
	}


	@Override
	public List<TYearEffectInfo> getYearEffectByErpNo(String erpNo){
		StringBuilder sqlBuilder = new StringBuilder("select t.*,GET_DIC('PerformLevelRecentThreeYears',perfor_grade) as perfor_grade_name from t_year_effect_info_drafts t where t.is_valid='1' and t.del_sign = '0' ");
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by rate_year_start desc");
		return this.findAllBySQL(TYearEffectInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

	@Override
	public void findPageYearEffectByCondi(Page<TYearEffectInfo> page, TYearEffectInfo tYearEffectInfo) {
		String sql = "  select t.* " +
                " from t_year_effect_info_drafts t  where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();
        if (!StringUtil.isNullOrEmpty(tYearEffectInfo.getErpNo())) {
            sqlBuilder.append(" AND erp_no= ? ");
            arrayList.add(tYearEffectInfo.getErpNo());
        }

		sqlBuilder.append(" order by rate_year desc  ");
		this.findPageBySql(TYearEffectInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void addEducateInfo(TEducateInfo tEducateInfo) {
		String sql = "insert into t_educate_info_drafts (id,start_time,end_time,acqu_time,grad_school,school_type,major,educ_name,degree_name,is_cont_educ,is_employ_educ,is_highest_educ,erp_no,user_name,id_card_no,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},")
				.append("#{start_time,jdbcType=DATE},").append("#{end_time,jdbcType=DATE},")
				.append("#{acqu_time,jdbcType=VARCHAR},")
				.append("#{grad_school,jdbcType=VARCHAR},").append("#{school_type,jdbcType=VARCHAR},")
				.append("#{major,jdbcType=VARCHAR},").append("#{educ_name,jdbcType=VARCHAR},")
				.append("#{degree_name,jdbcType=VARCHAR},").append("#{is_cont_educ,jdbcType=VARCHAR},")
				.append("#{is_employ_educ,jdbcType=VARCHAR},").append("#{is_highest_educ,jdbcType=VARCHAR},")
				.append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},").append("#{id_card_no,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tEducateInfo.getId());
		params.put("start_time", tEducateInfo.getStartTime());
		params.put("end_time", tEducateInfo.getEndTime());
		params.put("acqu_time", tEducateInfo.getAcquTime());
		params.put("grad_school", tEducateInfo.getGradSchool());
		params.put("school_type", tEducateInfo.getSchoolType());
		params.put("major", tEducateInfo.getMajor());
		params.put("educ_name", tEducateInfo.getEducName());
		params.put("degree_name", tEducateInfo.getDegreeName());
		params.put("is_cont_educ", tEducateInfo.getIsContEduc());
		params.put("is_employ_educ", tEducateInfo.getIsEmployEduc());
		params.put("is_highest_educ", tEducateInfo.getIsHighestEduc());
		params.put("erp_no", tEducateInfo.getErpNo());
		params.put("user_name", tEducateInfo.getUserName());
		params.put("id_card_no", tEducateInfo.getIdCardNo());
		params.put("creater_id", tEducateInfo.getCreaterId());
		params.put("creater_name", tEducateInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tEducateInfo.getUpdaterId());
		params.put("updater_name", tEducateInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tEducateInfo.getDelSign());
		params.put("is_valid", tEducateInfo.getIsValid());
		params.put("audit_state", tEducateInfo.getAuditState());
		params.put("orignal_id", tEducateInfo.getOrignalId());
		params.put("flow_status",tEducateInfo.getFlowStatus());
		params.put("business_type_id",tEducateInfo.getBusinessTypeId());
		params.put("isc_user_id",tEducateInfo.getIscUserId());
		params.put("primitive_id",tEducateInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TEducateInfo getEducateInfoById(String id) {
		String sql = " select t.*,GET_DIC('CollegeCategory',school_type) as school_type_name, " +
				"   GET_DIC('PersonnelQualifications',educ_name) as educ_name_name, " +
				"   GET_DIC('AcademicDegree',degree_name) as degree_name_name  " +
				"   from t_educate_info_drafts t  " +
				"   where t.id= ? and t.del_sign = '0' ";
		return this.findUnique(TEducateInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TEducateInfo> getEducateInfoByErpNo(String erpNo,String isCountEduc) {
		String sql = " select t.*,GET_DIC('CollegeCategory',school_type) as school_type_name, " +
				"   GET_DIC('PersonnelQualifications',educ_name) as educ_name_name, " +
				"   GET_DIC('AcademicDegree',degree_name) as degree_name_name  " +
				"   from t_educate_info_drafts t where t.is_valid='1' and t.del_sign = '0' ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		if (StringUtils.isNotBlank(isCountEduc)) {
			sqlBuilder.append(" AND is_cont_educ= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by end_time desc");
		return this.findAllBySQL(TEducateInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageEducateInfoByCondi(Page<TEducateInfo> page, TEducateInfo tEducateInfo) {
        String sql = "  select t.* " +
                " from t_educate_info_drafts t " +
                " where  t.is_valid='1' and t.del_sign = '0' " ;
        StringBuilder sqlBuilder = new StringBuilder(sql);

        ArrayList<Object> arrayList = new ArrayList<Object>();
        if (!StringUtil.isNullOrEmpty(tEducateInfo.getErpNo())) {
            sqlBuilder.append(" AND erp_no= ? ");
            arrayList.add(tEducateInfo.getErpNo());
        }

		if (!StringUtil.isNullOrEmpty(tEducateInfo.getIsContEduc())) {
			sqlBuilder.append(" AND is_cont_educ= ? ");
			arrayList.add(tEducateInfo.getIsContEduc());
		}

        sqlBuilder.append(" order by acqu_time desc  ");
        this.findPageBySql(TEducateInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addProTecInfo(TProTecInfo tProTecInfo) {
		String sql = "insert into t_pro_tec_info_drafts (id,erp_no,user_name,id_card_no,acqu_time,subj_name,subj_set,subj_level,audit_org,org_level,cert_no,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{acqu_time,jdbcType=VARCHAR},")
				.append("#{subj_name,jdbcType=VARCHAR},").append("#{subj_set,jdbcType=VARCHAR},")
				.append("#{subj_level,jdbcType=VARCHAR},").append("#{audit_org,jdbcType=VARCHAR},").append("#{org_level,jdbcType=VARCHAR},")
				.append("#{cert_no,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tProTecInfo.getId());
		params.put("erp_no", tProTecInfo.getErpNo());
		params.put("user_name", tProTecInfo.getUserName());
		params.put("id_card_no", tProTecInfo.getIdCardNo());
		params.put("acqu_time", tProTecInfo.getAcquTime());
		params.put("subj_name", tProTecInfo.getSubjName());
		params.put("subj_set", tProTecInfo.getSubjSet());
		params.put("subj_level", tProTecInfo.getSubjLevel());
		params.put("audit_org", tProTecInfo.getAuditOrg());
		params.put("org_level", tProTecInfo.getOrgLevel());
		params.put("cert_no", tProTecInfo.getCertNo());
		params.put("creater_id", tProTecInfo.getCreaterId());
		params.put("creater_name", tProTecInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tProTecInfo.getUpdaterId());
		params.put("updater_name", tProTecInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tProTecInfo.getDelSign());
		params.put("is_valid", tProTecInfo.getIsValid());
		params.put("audit_state", tProTecInfo.getAuditState());
		params.put("orignal_id", tProTecInfo.getOrignalId());
		params.put("flow_status",tProTecInfo.getFlowStatus());
		params.put("business_type_id",tProTecInfo.getBusinessTypeId());
		params.put("isc_user_id",tProTecInfo.getIscUserId());
		params.put("primitive_id",tProTecInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TProTecInfo getProTecInfoById(String id) {
		String sql = " select t.*,GET_DIC('ProTechnicalQualifications',subj_set) as subj_set_name, " +
				" GET_DIC('ProfessionalQualifications',subj_level) as subj_level_name, " +
				" GET_DIC('IdentificationUnitLevel',org_level) as org_level_name  " +
				"  from t_pro_tec_info_drafts t   where t.id= ? and t.del_sign = '0' " ;
		return this.findUnique(TProTecInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TProTecInfo> getProTecInfoByErpNo(String erpNo) {
		String sql = " select t.*,GET_DIC('ProTechnicalQualifications',subj_set) as subj_set_name, " +
				" GET_DIC('ProfessionalQualifications',subj_level) as subj_level_name, " +
				" GET_DIC('IdentificationUnitLevel',org_level) as org_level_name  " +
				"  from t_pro_tec_info_drafts t   where t.is_valid='1'  and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by acqu_time desc");
		return this.findAllBySQL(TProTecInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageProTecInfoByCondi(Page<TProTecInfo> page, TProTecInfo tProTecInfo) {
        String sql = " select t.* " +
                "  from t_pro_tec_info_drafts t   where t.is_valid='1' and t.del_sign = '0' " ;
        StringBuilder sqlBuilder = new StringBuilder(sql);

        ArrayList<Object> arrayList = new ArrayList<Object>();
        if (!StringUtil.isNullOrEmpty(tProTecInfo.getErpNo())) {
            sqlBuilder.append(" AND erp_no= ? ");
            arrayList.add(tProTecInfo.getErpNo());
        }

        sqlBuilder.append(" order by acqu_time desc  ");
        this.findPageBySql(TProTecInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addSkillLevelInfo(TSkillLevelInfo tSkillLevelInfo) {
		String sql = "insert into t_skill_level_info_drafts (id,erp_no,user_name,id_card_no,acqu_time,tech_type,qualifi_level,audit_org,org_level,cert_no,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{acqu_time,jdbcType=VARCHAR},")
				.append("#{tech_type,jdbcType=VARCHAR},").append("#{qualifi_level,jdbcType=VARCHAR},")
				.append("#{audit_org,jdbcType=VARCHAR},").append("#{org_level,jdbcType=VARCHAR},").append("#{cert_no,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},").append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tSkillLevelInfo.getId());
		params.put("erp_no", tSkillLevelInfo.getErpNo());
		params.put("user_name", tSkillLevelInfo.getUserName());
		params.put("id_card_no", tSkillLevelInfo.getIdCardNo());
		params.put("acqu_time", tSkillLevelInfo.getAcquTime());
		params.put("tech_type", tSkillLevelInfo.getTechType());
		params.put("qualifi_level", tSkillLevelInfo.getQualifiLevel());
		params.put("audit_org", tSkillLevelInfo.getAuditOrg());	
		params.put("org_level", tSkillLevelInfo.getOrgLevel());
		params.put("cert_no", tSkillLevelInfo.getCertNo());
		params.put("creater_id", tSkillLevelInfo.getCreaterId());
		params.put("creater_name", tSkillLevelInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tSkillLevelInfo.getUpdaterId());
		params.put("updater_name", tSkillLevelInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tSkillLevelInfo.getDelSign());
		params.put("is_valid", tSkillLevelInfo.getIsValid());
		params.put("audit_state", tSkillLevelInfo.getAuditState());
		params.put("orignal_id", tSkillLevelInfo.getOrignalId());
		params.put("flow_status",tSkillLevelInfo.getFlowStatus());
		params.put("business_type_id",tSkillLevelInfo.getBusinessTypeId());
		params.put("isc_user_id",tSkillLevelInfo.getIscUserId());
		params.put("primitive_id",tSkillLevelInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TSkillLevelInfo getTSkillLevelInfoById(String id) {
		String sql = "  select t.*,GET_DIC('SkillAppraisalWork',tech_type) as tech_type_name, " +
				" GET_DIC('QualificationLevel',qualifi_level) as qualifi_level_name, " +
				" GET_DIC('IdentificationUnitLevel',org_level) as org_level_name " +
				" from t_skill_level_info_drafts t where t.id = ?  and t.del_sign = '0' " ;
		return this.findUnique(TSkillLevelInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TSkillLevelInfo> getSkillLevelInfoByErpNo(String erpNo) {
		String sql = "  select t.*,GET_DIC('SkillAppraisalWork',tech_type) as tech_type_name, " +
				" GET_DIC('QualificationLevel',qualifi_level) as qualifi_level_name, " +
				" GET_DIC('IdentificationUnitLevel',org_level) as org_level_name " +
				" from t_skill_level_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by acqu_time desc");
		return this.findAllBySQL(TSkillLevelInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageSkillLevelInfoByCondi(Page<TSkillLevelInfo> page, TSkillLevelInfo tSkillLevelInfo) {
        String sql = "  select t.* " +
                " from t_skill_level_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
        StringBuilder sqlBuilder = new StringBuilder(sql);

        ArrayList<Object> arrayList = new ArrayList<Object>();
        if (!StringUtil.isNullOrEmpty(tSkillLevelInfo.getErpNo())) {
            sqlBuilder.append(" AND erp_no= ? ");
            arrayList.add(tSkillLevelInfo.getErpNo());
        }

        sqlBuilder.append(" order by acqu_time desc  ");
        this.findPageBySql(TSkillLevelInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addExpertTitleInfo(TExpertTitleInfo tExpertTitleInfo) {
		String sql = "insert into t_expert_title_info_drafts (id,erp_no,user_name,id_card_no,major,acqu_time,level_name,type,emp_term_start,emp_term_end,emp_title,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{major,jdbcType=VARCHAR},")
				.append("#{acqu_time,jdbcType=VARCHAR},").append("#{level_name,jdbcType=VARCHAR},")
				.append("#{type,jdbcType=VARCHAR},").append("#{emp_term_start,jdbcType=VARCHAR},")
				.append("#{emp_term_end,jdbcType=VARCHAR},").append("#{emp_title,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tExpertTitleInfo.getId());
		params.put("erp_no", tExpertTitleInfo.getErpNo());
		params.put("user_name", tExpertTitleInfo.getUserName());
		params.put("id_card_no", tExpertTitleInfo.getIdCardNo());
		params.put("major", tExpertTitleInfo.getMajor());
		params.put("acqu_time", tExpertTitleInfo.getAcquTime());
		params.put("level_name", tExpertTitleInfo.getLevelName());
		params.put("type", tExpertTitleInfo.getType());
		params.put("emp_term_start", tExpertTitleInfo.getEmpTermStart());
		params.put("emp_term_end", tExpertTitleInfo.getEmpTermEnd());
		params.put("emp_title", tExpertTitleInfo.getEmpTitle());
		params.put("creater_id", tExpertTitleInfo.getCreaterId());
		params.put("creater_name", tExpertTitleInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tExpertTitleInfo.getUpdaterId());
		params.put("updater_name", tExpertTitleInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tExpertTitleInfo.getDelSign());
		params.put("is_valid", tExpertTitleInfo.getIsValid());
		params.put("audit_state", tExpertTitleInfo.getAuditState());
		params.put("orignal_id", tExpertTitleInfo.getOrignalId());
		params.put("flow_status",tExpertTitleInfo.getFlowStatus());
		params.put("business_type_id",tExpertTitleInfo.getBusinessTypeId());
		params.put("isc_user_id",tExpertTitleInfo.getIscUserId());
		params.put("primitive_id",tExpertTitleInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TExpertTitleInfo getExpertTitleInfoById(String id) {
		String sql = "  select t.*,GET_DIC('ProWorkTypes',major) as major_name, " +
				" GET_DIC('TalentTitle',emp_title) as emp_title_name, " +
				" GET_DIC('ExpertLevel',level_name) as level_name_name, " +
				" GET_DIC('ExpertCategory',type) as type_name  " +
				" from t_expert_title_info_drafts t where t.id = ?  and t.del_sign = '0' " ;
		return this.findUnique(TExpertTitleInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TExpertTitleInfo> getExpertTitleInfoByErpNo(String erpNo) {
		String sql = "  select t.*,GET_DIC('ProWorkTypes',major) as major_name, " +
				" GET_DIC('TalentTitle',emp_title) as emp_title_name, " +
				" GET_DIC('ExpertLevel',level_name) as level_name_name, " +
				" GET_DIC('ExpertCategory',type) as type_name  " +
				" from t_expert_title_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by acqu_time desc");
		return this.findAllBySQL(TExpertTitleInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageExpertTitleInfoByCondi(Page<TExpertTitleInfo> page, TExpertTitleInfo tExpertTitleInfo) {
        String sql = "  select t.* " +
                " from t_expert_title_info_drafts t where  t.is_valid='1' and t.del_sign = '0' " ;
        StringBuilder sqlBuilder = new StringBuilder(sql);

        ArrayList<Object> arrayList = new ArrayList<Object>();
        if (!StringUtil.isNullOrEmpty(tExpertTitleInfo.getErpNo())) {
            sqlBuilder.append(" AND erp_no= ? ");
            arrayList.add(tExpertTitleInfo.getErpNo());
        }

        sqlBuilder.append(" order by acqu_time desc  ");
        this.findPageBySql(TExpertTitleInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addAcadeAchiveInfo(TAcadeAchiveInfo tAcadeAchiveInfo) {
		String sql = "insert into t_acade_achive_info_drafts (id,pub_time,acad_type,acad_name,summary,pub_name,issn,periodic_no,page,publisher,level,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{pub_time,jdbcType=VARCHAR},")
				.append("#{acad_type,jdbcType=VARCHAR},").append("#{acad_name,jdbcType=VARCHAR},")
				.append("#{summary,jdbcType=VARCHAR},").append("#{pub_name,jdbcType=VARCHAR},")
				.append("#{issn,jdbcType=VARCHAR},").append("#{periodic_no,jdbcType=VARCHAR},")
				.append("#{page,jdbcType=VARCHAR},").append("#{publisher,jdbcType=VARCHAR},")
				.append("#{level,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tAcadeAchiveInfo.getId());
		params.put("pub_time", tAcadeAchiveInfo.getPubTime());
		params.put("acad_type", tAcadeAchiveInfo.getAcadType());
		params.put("acad_name", tAcadeAchiveInfo.getAcadName());
		params.put("summary", tAcadeAchiveInfo.getSummary());
		params.put("pub_name", tAcadeAchiveInfo.getPubName());
		params.put("issn", tAcadeAchiveInfo.getIssn());
		params.put("periodic_no", tAcadeAchiveInfo.getPeriodicNo());
		params.put("page", tAcadeAchiveInfo.getPage());
		params.put("publisher", tAcadeAchiveInfo.getPublisher());
		params.put("level", tAcadeAchiveInfo.getLevel());
		params.put("creater_id", tAcadeAchiveInfo.getCreaterId());
		params.put("creater_name", tAcadeAchiveInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tAcadeAchiveInfo.getUpdaterId());
		params.put("updater_name", tAcadeAchiveInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", 0);
		params.put("is_valid", tAcadeAchiveInfo.getIsValid());
		params.put("audit_state", tAcadeAchiveInfo.getAuditState());
		params.put("orignal_id", tAcadeAchiveInfo.getOrignalId());
		params.put("flow_status",tAcadeAchiveInfo.getFlowStatus());
		params.put("business_type_id",tAcadeAchiveInfo.getBusinessTypeId());
		params.put("isc_user_id",tAcadeAchiveInfo.getIscUserId());
		params.put("primitive_id",tAcadeAchiveInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TAcadeAchiveInfoVo getAcadeAchiveInfoById(String id) {
		String sql = " select t.*, " +
				" GET_DIC('XueshuchengguoType',t.acad_type) as acad_type_name, " +
				" GET_DIC('XueshuchengguoJb',t.level) as level_name " +
				" from t_acade_achive_info_drafts t " +
				" where t.id= ? and t.del_sign = '0' " ;
		return this.findUnique(TAcadeAchiveInfoVo.class, sql, new Object[] { id });
	}

	@Override
	public List<TAcadeAchiveInfoVo> getAcadeAchiveInfoByErpNo(String erpNo) {
		String sql = " select t.*,r.role,r.rank,r.erp_no, " +
				" GET_DIC('XueshuchengguoJs',r.role) as role_name, " +
				" GET_DIC('XueshuchengguoType',t.acad_type) as acad_type_name, " +
				" GET_DIC('XueshuchengguoJb',t.level) as level_name " +
				" from t_part_rank_drafts r right join t_acade_achive_info_drafts t " +
				" on r.item_id=t.id where r.item_type='12'  and  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND t.creater_id= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by pub_time desc");
		return this.findAllBySQL(TAcadeAchiveInfoVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}



//    @Override
//    public void findPageAcadeAchiveInfoByCondi(Page<TAcadeAchiveInfoVo> page, TAcadeAchiveInfo tAcadeAchiveInfo) {
//        String sql = " select t.*,r.role,r.rank,r.erp_no " +
//                " from t_part_rank_drafts r right join t_acade_achive_info_drafts t " +
//                " on r.item_id=t.id where r.item_type='12' and  t.is_valid='1' and t.del_sign = '0' " ;
//        StringBuilder sqlBuilder = new StringBuilder(sql);
//
//        ArrayList<Object> arrayList = new ArrayList<Object>();
//
//        StringBuilder erp_no_sb= new StringBuilder();
//
//        if(!tAcadeAchiveInfo.gettPartRankList().isEmpty()){
//            tAcadeAchiveInfo.gettPartRankList().forEach(tPartRank->{
//                if(!StringUtil.isNullOrEmpty(tPartRank.getErpNo())){
//                    erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
//                }
//            });
//        }
//
//        if(!StringUtil.isNullOrEmpty(erp_no_sb.toString())){
//            sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
//            //arrayList.add(erp_no_sb.toString().substring(1));
//        }
//        sqlBuilder.append(" order by pub_time desc ");
//        this.findPageBySql(TAcadeAchiveInfoVo.class, sqlBuilder.toString(), page, null);
//    }
    
    @Override
    public void findPageAcadeAchiveInfoByCondi(Page<TAcadeAchiveInfoVo> page, TAcadeAchiveInfo tAcadeAchiveInfo) {
        String sql = " select t.* " +
                " from t_acade_achive_info_drafts t " +
                " where t.is_valid='1' and t.del_sign = '0' " ;
        StringBuilder sqlBuilder = new StringBuilder(sql);

        ArrayList<Object> arrayList = new ArrayList<Object>();

        StringBuilder erp_no_sb= new StringBuilder();

        if(!tAcadeAchiveInfo.gettPartRankList().isEmpty()){
            tAcadeAchiveInfo.gettPartRankList().forEach(tPartRank->{
                if(!StringUtil.isNullOrEmpty(tPartRank.getErpNo())){
                    erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
                }
            });
        }

        if(!StringUtil.isNullOrEmpty(erp_no_sb.toString())){
            sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
            //arrayList.add(erp_no_sb.toString().substring(1));
        }
        sqlBuilder.append(" order by pub_time desc ");
        this.findPageBySql(TAcadeAchiveInfoVo.class, sqlBuilder.toString(), page, null);
    }

    @Override
	public void addStandInfo(TStandInfo tStandInfo) {
		String sql = "insert into t_stand_info_drafts (id,issue_time,name,type,level,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{issue_time,jdbcType=VARCHAR},")
				.append("#{name,jdbcType=VARCHAR},").append("#{type,jdbcType=VARCHAR},")
				.append("#{level,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tStandInfo.getId());
		params.put("issue_time", tStandInfo.getIssueTime());
		params.put("name", tStandInfo.getName());
		params.put("type", tStandInfo.getType());
		params.put("level", tStandInfo.getLevel());
		params.put("creater_id", tStandInfo.getCreaterId());
		params.put("creater_name", tStandInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tStandInfo.getUpdaterId());
		params.put("updater_name", tStandInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tStandInfo.getDelSign());
		params.put("is_valid", tStandInfo.getIsValid());
		params.put("audit_state", tStandInfo.getAuditState());
		params.put("orignal_id", tStandInfo.getOrignalId());
		params.put("flow_status",tStandInfo.getFlowStatus());
		params.put("business_type_id",tStandInfo.getBusinessTypeId());
		params.put("isc_user_id",tStandInfo.getIscUserId());
		params.put("primitive_id",tStandInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TStandInfoVo getStandInfoById(String id) {
		String sql = "  select t.*,  " +
				" GET_DIC('ZdbzType',t.type) as type_name,  " +
				" GET_DIC('JygexinQcJb',t.level) as level_name  " +
				" from t_stand_info_drafts t  " +
				" where t.id= ?  and t.del_sign = '0' " ;
		return this.findUnique(TStandInfoVo.class, sql, new Object[] { id });
	}

	@Override
	public List<TStandInfoVo> getStandInfoByErpNo(String erpNo) {
		String sql = "  select t.*,r.role,r.rank,r.erp_no,  " +
				" GET_DIC('XueshuchengguoJs',r.role) as role_name,  " +
				" GET_DIC('ZdbzType',t.type) as type_name,  " +
				" GET_DIC('JygexinQcJb',t.level) as level_name  " +
				" from t_part_rank_drafts r right join t_stand_info_drafts t  " +
				" on r.item_id=t.id where r.item_type='13' and  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND t.creater_id= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by issue_time desc");
		return this.findAllBySQL(TStandInfoVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageStandInfoByCondi(Page<TStandInfoVo> page, TStandInfo tStandInfo) {
		String sql = "  select t.* " +
				" from t_stand_info_drafts t  " +
				"  where  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();

		StringBuilder erp_no_sb= new StringBuilder();

		if(!tStandInfo.gettPartRankList().isEmpty()){
			tStandInfo.gettPartRankList().forEach(tPartRank->{
				if(!StringUtil.isNullOrEmpty(tPartRank.getErpNo())){
					erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
				}
			});
		}

		if(!StringUtil.isNullOrEmpty(erp_no_sb.toString())){
			sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
			//arrayList.add(erp_no_sb.toString().substring(1));
		}
		sqlBuilder.append(" order by issue_time desc ");
		this.findPageBySql(TStandInfoVo.class, sqlBuilder.toString(), page, null);
    }

    @Override
	public void addPatentInfo(TPatentInfo tPatentInfo) {
		String sql = "insert into t_patent_info_drafts (id,patent_name,patent_no,patent_type,apply_date,decl_date,inventor,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{patent_name,jdbcType=VARCHAR},")
				.append("#{patent_no,jdbcType=VARCHAR},").append("#{patent_type,jdbcType=VARCHAR},")
				.append("#{apply_date,jdbcType=VARCHAR},").append("#{decl_date,jdbcType=VARCHAR},")
				.append("#{inventor,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tPatentInfo.getId());
		params.put("patent_name", tPatentInfo.getPatentName());
		params.put("patent_no", tPatentInfo.getPatentNo());
		params.put("patent_type", tPatentInfo.getPatentType());
		params.put("apply_date", tPatentInfo.getApplyDate());
		params.put("decl_date", tPatentInfo.getDeclDate());
		params.put("inventor", tPatentInfo.getInventor());
		params.put("creater_id", tPatentInfo.getCreaterId());
		params.put("creater_name", tPatentInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tPatentInfo.getUpdaterId());
		params.put("updater_name", tPatentInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tPatentInfo.getDelSign());
		params.put("is_valid", tPatentInfo.getIsValid());
		params.put("audit_state", tPatentInfo.getAuditState());
		params.put("orignal_id", tPatentInfo.getOrignalId());
		params.put("flow_status",tPatentInfo.getFlowStatus());
		params.put("business_type_id",tPatentInfo.getBusinessTypeId());
		params.put("isc_user_id",tPatentInfo.getIscUserId());
		params.put("primitive_id",tPatentInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TPatentInfoVo getPatentInfoById(String id) {
		String sql = "   select t.*," +
				" GET_DIC('PatentType',t.patent_type) as patent_type_name " +
				" from t_patent_info_drafts t  " +
				" where t.id = ?  and t.del_sign = '0' " ;
		return this.findUnique(TPatentInfoVo.class, sql, new Object[] { id });
	}

	@Override
	public List<TPatentInfoVo> getPatentInfoByErpNo(String erpNo) {
		String sql = "   select t.*,r.role,r.rank,r.erp_no,  " +
				"  GET_DIC('XueshuchengguoJs',r.role) as role_name, " +
				" GET_DIC('PatentType',t.patent_type) as patent_type_name " +
				" from t_part_rank_drafts r right join t_patent_info_drafts t  " +
				" on r.item_id=t.id where r.item_type='14'  and  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND t.creater_id= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by apply_date desc");
		return this.findAllBySQL(TPatentInfoVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPagePatentInfoByCondi(Page<TPatentInfoVo> page, TPatentInfo tPatentInfo) {
		String sql = "select t.* " +
				" from t_patent_info_drafts t  " +
				"  where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();

		StringBuilder erp_no_sb= new StringBuilder();

		if(!tPatentInfo.gettPartRankList().isEmpty()){
			tPatentInfo.gettPartRankList().forEach(tPartRank->{
				if(!StringUtil.isNullOrEmpty(tPartRank.getErpNo())){
					erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
				}
			});
		}

		if(!StringUtil.isNullOrEmpty(erp_no_sb.toString())){
			sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
			//arrayList.add(erp_no_sb.toString().substring(1));
		}
		sqlBuilder.append(" order by apply_date desc ");
		this.findPageBySql(TPatentInfoVo.class, sqlBuilder.toString(), page, null);
    }

    @Override
	public void addTecInnovInfo(TTecInnovInfo tTecInnovInfo) {
		String sql = "insert into t_tec_innov_info_drafts (id,achi_name,sumary,award_name,award_date,award_org,award_level,award_grade,group_name,member_name,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{achi_name,jdbcType=VARCHAR},")
				.append("#{sumary,jdbcType=VARCHAR},").append("#{award_name,jdbcType=VARCHAR},")
				.append("#{award_date,jdbcType=VARCHAR},").append("#{award_org,jdbcType=VARCHAR},")
				.append("#{award_level,jdbcType=VARCHAR},").append("#{award_grade,jdbcType=VARCHAR},")
				.append("#{group_name,jdbcType=VARCHAR},").append("#{member_name,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tTecInnovInfo.getId());
		params.put("achi_name", tTecInnovInfo.getAchiName());
		params.put("sumary", tTecInnovInfo.getSumary());
		params.put("award_name", tTecInnovInfo.getAwardName());
		params.put("award_date", tTecInnovInfo.getAwardDate());
		params.put("award_org", tTecInnovInfo.getAwardOrg());
		params.put("award_level", tTecInnovInfo.getAwardLevel());
		params.put("award_grade", tTecInnovInfo.getAwardGrade());
		params.put("group_name", tTecInnovInfo.getGroupName());
		params.put("member_name", tTecInnovInfo.getMemberName());
		params.put("creater_id", tTecInnovInfo.getCreaterId());
		params.put("creater_name", tTecInnovInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tTecInnovInfo.getUpdaterId());
		params.put("updater_name", tTecInnovInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tTecInnovInfo.getDelSign());
		params.put("is_valid", tTecInnovInfo.getIsValid());
		params.put("audit_state", tTecInnovInfo.getAuditState());
		params.put("orignal_id", tTecInnovInfo.getOrignalId());
		params.put("flow_status",tTecInnovInfo.getFlowStatus());
		params.put("business_type_id",tTecInnovInfo.getBusinessTypeId());
		params.put("isc_user_id",tTecInnovInfo.getIscUserId());
		params.put("primitive_id",tTecInnovInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TTecInnovInfoVo getTecInnovInfoById(String id) {
		String sql = "    select t.*," +
				" GET_DIC('JygexinQcJb',t.award_level) as award_level_name, " +
				" GET_DIC('JygexinQcDj',t.award_grade) as award_grade_name " +
				" from t_tec_innov_info_drafts t  " +
				" where t.id = ?  and t.del_sign = '0' " ;
		return this.findUnique(TTecInnovInfoVo.class, sql, new Object[] { id });
	}

	@Override
	public List<TTecInnovInfoVo> getTecInnovInfoByErpNo(String erpNo) {
		String sql = "    select t.*,r.role,r.rank,r.erp_no, " +
				" GET_DIC('XueshuchengguoJs',r.role) as role_name, " +
				" GET_DIC('JygexinQcJb',t.award_level) as award_level_name, " +
				" GET_DIC('JygexinQcDj',t.award_grade) as award_grade_name " +
				" from t_part_rank_drafts r right join t_tec_innov_info_drafts t  " +
				" on r.item_id=t.id where r.item_type='15' and  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND t.creater_id= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by award_date desc");
		return this.findAllBySQL(TTecInnovInfoVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageTecInnovInfoByCondi(Page<TTecInnovInfoVo> page, TTecInnovInfo tTecInnovInfo) {
		String sql = " select t.* " +
				" from t_tec_innov_info_drafts t  " +
				" where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();

		StringBuilder erp_no_sb= new StringBuilder();

		if(!tTecInnovInfo.gettPartRankList().isEmpty()){
			tTecInnovInfo.gettPartRankList().forEach(tPartRank->{
				if(!StringUtil.isNullOrEmpty(tPartRank.getErpNo())){
					erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
				}
			});
		}

		if(!StringUtil.isNullOrEmpty(erp_no_sb.toString())){
			sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
			//arrayList.add(erp_no_sb.toString().substring(1));
		}
		sqlBuilder.append(" order by award_date desc ");
		this.findPageBySql(TTecInnovInfoVo.class, sqlBuilder.toString(), page, null);
    }

    @Override
	public void addContestInfo(TContestInfo tContestInfo) {
		String sql = "insert into t_contest_info_drafts (id,erp_no,user_name,id_card_no,award_date,comp_name,host_org,award_name,award_level,comp_rank,get_title,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{award_date,jdbcType=VARCHAR},")
				.append("#{comp_name,jdbcType=VARCHAR},").append("#{host_org,jdbcType=VARCHAR},").append("#{award_name,jdbcType=VARCHAR},")
				.append("#{award_level,jdbcType=VARCHAR},").append("#{comp_rank,jdbcType=VARCHAR},")
				.append("#{get_title,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tContestInfo.getId());
		params.put("erp_no", tContestInfo.getErpNo());
		params.put("user_name", tContestInfo.getUserName());
		params.put("id_card_no", tContestInfo.getIdCardNo());
		params.put("award_date", tContestInfo.getAwardDate());
		params.put("comp_name", tContestInfo.getCompName());
		params.put("host_org", tContestInfo.getHostOrg());
		params.put("award_name", tContestInfo.getAwardName());
		params.put("award_level", tContestInfo.getAwardLevel());
		params.put("comp_rank", tContestInfo.getCompRank());
		params.put("get_title", tContestInfo.getGetTitle());
		params.put("creater_id", tContestInfo.getCreaterId());
		params.put("creater_name", tContestInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tContestInfo.getUpdaterId());
		params.put("updater_name", tContestInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tContestInfo.getDelSign());
		params.put("is_valid", tContestInfo.getIsValid());
		params.put("audit_state", tContestInfo.getAuditState());
		params.put("orignal_id", tContestInfo.getOrignalId());
		params.put("flow_status",tContestInfo.getFlowStatus());
		params.put("business_type_id",tContestInfo.getBusinessTypeId());
		params.put("isc_user_id",tContestInfo.getIscUserId());
		params.put("primitive_id",tContestInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TContestInfo getContestInfoById(String id) {
		String sql = "  select t.*," +
				" GET_DIC('JygexinQcJb',award_level) as award_level_name,  " +
				" GET_DIC('JygexinQcDj',t.comp_rank) as comp_rank_name   " +
				" from t_contest_info_drafts t where t.id= ?  and t.del_sign = '0' " ;
		return this.findUnique(TContestInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TContestInfo> getContestInfoByErpNo(String erpNo) {
		String sql = "  select t.*," +
				" GET_DIC('JygexinQcJb',award_level) as award_level_name,  " +
				" GET_DIC('JygexinQcDj',t.comp_rank) as comp_rank_name   " +
				" from t_contest_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by award_date desc");
		return this.findAllBySQL(TContestInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageContestInfoByCondi(Page<TContestInfo> page, TContestInfo tContestInfo) {
		String sql = "  select t.* " +
				" from t_contest_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (!StringUtil.isNullOrEmpty(tContestInfo.getErpNo())) {
			sqlBuilder.append(" AND erp_no= ? ");
			arrayList.add(tContestInfo.getErpNo());
		}

		sqlBuilder.append(" order by award_date desc  ");
		this.findPageBySql(TContestInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addTecManInnov(TTecManInnov tTecManInnov) {
		String sql = "insert into t_tec_man_innov_drafts (id,achi_name,achi_type,summary,award_name,award_date,award_org,award_level,award_grade,group_name,member_name,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{achi_name,jdbcType=VARCHAR},").append("#{achi_type,jdbcType=VARCHAR},")
				.append("#{summary,jdbcType=VARCHAR},").append("#{award_name,jdbcType=VARCHAR},")
				.append("#{award_date,jdbcType=VARCHAR},").append("#{award_org,jdbcType=VARCHAR},")
				.append("#{award_level,jdbcType=VARCHAR},").append("#{award_grade,jdbcType=VARCHAR},")
				.append("#{group_name,jdbcType=VARCHAR},").append("#{member_name,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tTecManInnov.getId());
		params.put("achi_name", tTecManInnov.getAchiName());
		params.put("achi_type", tTecManInnov.getAchiType());
		params.put("summary", tTecManInnov.getSummary());
		params.put("award_name", tTecManInnov.getAwardName());
		params.put("award_date", tTecManInnov.getAwardDate());
		params.put("award_org", tTecManInnov.getAwardOrg());
		params.put("award_level", tTecManInnov.getAwardLevel());
		params.put("award_grade", tTecManInnov.getAwardGrade());
		params.put("group_name", tTecManInnov.getGroupName());
		params.put("member_name", tTecManInnov.getMemberName());
		params.put("creater_id", tTecManInnov.getCreaterId());
		params.put("creater_name", tTecManInnov.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tTecManInnov.getUpdaterId());
		params.put("updater_name", tTecManInnov.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tTecManInnov.getDelSign());
		params.put("is_valid", tTecManInnov.getIsValid());
		params.put("audit_state", tTecManInnov.getAuditState());
		params.put("orignal_id", tTecManInnov.getOrignalId());
		params.put("flow_status",tTecManInnov.getFlowStatus());
		params.put("business_type_id",tTecManInnov.getBusinessTypeId());
		params.put("isc_user_id",tTecManInnov.getIscUserId());
		params.put("primitive_id",tTecManInnov.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TTecManInnovVo getTecManInnovById(String id) {
		String sql = "  select t.*," +
				"  GET_DIC('JygexinQcJb',t.award_level) as award_level_name, " +
				"  GET_DIC('JygexinQcDj',t.award_grade) as award_grade_name, " +
				"  GET_DIC('KjglAchiveType',t.achi_type) as achi_type_name " +
				" from t_tec_man_innov_drafts t  " +
				" where t.id= ? and t.del_sign = '0' " ;
		return this.findUnique(TTecManInnovVo.class, sql, new Object[] { id });
	}

	@Override
	public List<TTecManInnovVo> getTecManInnovByErpNo(String erpNo) {
		String sql = "  select t.*,r.role,r.rank,r.erp_no, " +
				"  GET_DIC('XueshuchengguoJs',r.role) as role_name, " +
				"  GET_DIC('KjglAchiveType',t.achi_type) as achi_type_name, " +
				"  GET_DIC('JygexinQcJb',t.award_level) as award_level_name, " +
				"  GET_DIC('JygexinQcDj',t.award_grade) as award_grade_name " +
				" from t_part_rank_drafts r right join t_tec_man_innov_drafts t  " +
				" on r.item_id=t.id where r.item_type='16' and  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND t.creater_id= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by award_date desc");
		return this.findAllBySQL(TTecManInnovVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageTecManInnovByCondi(Page<TTecManInnovVo> page, TTecManInnov tTecManInnov) {
		String sql = "  select t.* " +
				" from t_tec_man_innov_drafts t  " +
				" where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();

		StringBuilder erp_no_sb= new StringBuilder();

		if(!tTecManInnov.gettPartRankList().isEmpty()){
			tTecManInnov.gettPartRankList().forEach(tPartRank->{
				if(!StringUtil.isNullOrEmpty(tPartRank.getErpNo())){
					erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
				}
			});
		}

		if(!StringUtil.isNullOrEmpty(erp_no_sb.toString())){
			sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
			//arrayList.add(erp_no_sb.toString().substring(1));
		}
		sqlBuilder.append(" order by award_date desc ");
		this.findPageBySql(TTecManInnovVo.class, sqlBuilder.toString(), page, null);
    }

    @Override
	public void addHonorInfo(THonorInfo tHonorInfo) {
		String sql = "insert into t_honor_info_drafts (id,erp_no,user_name,id_card_no,acqu_time,honor_title,award_org,honor_level,honor_type,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{acqu_time,jdbcType=VARCHAR},")
				.append("#{honor_title,jdbcType=VARCHAR},").append("#{award_org,jdbcType=VARCHAR},")
				.append("#{honor_level,jdbcType=VARCHAR},").append("#{honor_type,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tHonorInfo.getId());
		params.put("erp_no", tHonorInfo.getErpNo());
		params.put("user_name", tHonorInfo.getUserName());
		params.put("id_card_no", tHonorInfo.getIdCardNo());
		params.put("acqu_time", tHonorInfo.getAcquTime());
		params.put("honor_title", tHonorInfo.getHonorTitle());
		params.put("award_org", tHonorInfo.getAwardOrg());
		params.put("honor_level", tHonorInfo.getHonorLevel());
		params.put("honor_type", tHonorInfo.getHonorType());
		params.put("creater_id", tHonorInfo.getCreaterId());
		params.put("creater_name", tHonorInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tHonorInfo.getUpdaterId());
		params.put("updater_name", tHonorInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tHonorInfo.getDelSign());
		params.put("is_valid", tHonorInfo.getIsValid());
		params.put("audit_state", tHonorInfo.getAuditState());
		params.put("orignal_id", tHonorInfo.getOrignalId());
		params.put("flow_status",tHonorInfo.getFlowStatus());
		params.put("business_type_id",tHonorInfo.getBusinessTypeId());
		params.put("isc_user_id",tHonorInfo.getIscUserId());
		params.put("primitive_id",tHonorInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public THonorInfo getHonorInfoById(String id) {
		String sql = " select t.*, " +
				"  GET_DIC('JygexinQcJb',honor_level) as honor_level_name,  " +
				" GET_DIC('RuYuLeiBie',t.honor_type) as honor_type_name   " +
				" from t_honor_info_drafts t where t.id = ? and t.del_sign = '0' " ;
		return this.findUnique(THonorInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<THonorInfo> getHonnorInfoByErpNo(String erpNo) {
		String sql = " select t.*, " +
				"  GET_DIC('JygexinQcJb',honor_level) as honor_level_name,  " +
				" GET_DIC('RuYuLeiBie',t.honor_type) as honor_type_name   " +
				" from t_honor_info_drafts t where t.is_valid='1'  and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by acqu_time desc");
		return this.findAllBySQL(THonorInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageHonorInfoByCondi(Page<THonorInfo> page, THonorInfo tHonorInfo) {

		String sql = " select t.* " +
				" from t_honor_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (!StringUtil.isNullOrEmpty(tHonorInfo.getErpNo())) {
			sqlBuilder.append(" AND erp_no= ? ");
			arrayList.add(tHonorInfo.getErpNo());
		}

		sqlBuilder.append(" order by acqu_time desc  ");
		this.findPageBySql(THonorInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addWorkExpInfo(TWorkExpInfo tWorkExpInfo) {
		String sql = "insert into t_work_exp_info_drafts (id,erp_no,user_name,id_card_no,start_date,end_date,company,dept,post,rank,job_content,post_type,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{start_date,jdbcType=VARCHAR},")
				.append("#{end_date,jdbcType=VARCHAR},").append("#{company,jdbcType=VARCHAR},")
				.append("#{dept,jdbcType=VARCHAR},").append("#{post,jdbcType=VARCHAR},")
				.append("#{rank,jdbcType=VARCHAR},").append("#{job_content,jdbcType=VARCHAR},")
				.append("#{post_type,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tWorkExpInfo.getId());
		params.put("erp_no", tWorkExpInfo.getErpNo());
		params.put("user_name", tWorkExpInfo.getUserName());
		params.put("id_card_no", tWorkExpInfo.getIdCardNo());
		params.put("start_date", tWorkExpInfo.getStartDate());
		params.put("end_date", tWorkExpInfo.getEndDate());
		params.put("company", tWorkExpInfo.getCompany());
		params.put("dept", tWorkExpInfo.getDept());
		params.put("post", tWorkExpInfo.getPost());
		params.put("rank", tWorkExpInfo.getRank());
		params.put("job_content", tWorkExpInfo.getJobContent());
		params.put("post_type", tWorkExpInfo.getPostType());
		params.put("creater_id", tWorkExpInfo.getCreaterId());
		params.put("creater_name", tWorkExpInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tWorkExpInfo.getUpdaterId());
		params.put("updater_name", tWorkExpInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tWorkExpInfo.getDelSign());
		params.put("is_valid", tWorkExpInfo.getIsValid());
		params.put("audit_state", tWorkExpInfo.getAuditState());
		params.put("orignal_id", tWorkExpInfo.getOrignalId());
		params.put("flow_status",tWorkExpInfo.getFlowStatus());
		params.put("business_type_id",tWorkExpInfo.getBusinessTypeId());
		params.put("isc_user_id",tWorkExpInfo.getIscUserId());
		params.put("primitive_id",tWorkExpInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TWorkExpInfo getWorkExpInfoById(String id) {
		String sql = "  select t.*," +
				"  GET_DIC('PostCategory',post_type) as post_type_name,  " +
				" GET_DIC('DutyLevel',rank) as rank_name   " +
				" from t_work_exp_info_drafts t where t.id = ? and t.del_sign = '0' ";
		return this.findUnique(TWorkExpInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TWorkExpInfo> getWorkExpInfoByErpNo(String erpNo) {
		String sql = "  select t.*," +
				"  GET_DIC('PostCategory',post_type) as post_type_name,  " +
				" GET_DIC('DutyLevel',rank) as rank_name   " +
				" from t_work_exp_info_drafts t where  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by start_date desc");
		return this.findAllBySQL(TWorkExpInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageWorkExpInfoByCondi(Page<TWorkExpInfo> page, TWorkExpInfo tWorkExpInfo) {
		String sql = "  select t.* " +
				" from t_work_exp_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (!StringUtil.isNullOrEmpty(tWorkExpInfo.getErpNo())) {
			sqlBuilder.append(" AND erp_no= ? ");
			arrayList.add(tWorkExpInfo.getErpNo());
		}

		sqlBuilder.append(" order by start_date desc  ");
		this.findPageBySql(TWorkExpInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addContiStudyInfo(TContiStudyInfo tContiStudyInfo) {
		String sql = "insert into t_conti_study_info_drafts (id,start_time,end_time,major,study_place,certifier,erp_no,user_name,id_card_no,type,level,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{start_time,jdbcType=VARCHAR},")
				.append("#{end_time,jdbcType=VARCHAR},").append("#{major,jdbcType=VARCHAR},")
				.append("#{study_place,jdbcType=VARCHAR},").append("#{certifier,jdbcType=VARCHAR},")
				.append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{type,jdbcType=VARCHAR},")
				.append("#{level,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tContiStudyInfo.getId());
		params.put("start_time", tContiStudyInfo.getStartTime());
		params.put("end_time", tContiStudyInfo.getEndTime());
		params.put("major", tContiStudyInfo.getMajor());
		params.put("study_place", tContiStudyInfo.getStudyPlace());
		params.put("certifier", tContiStudyInfo.getCertifier());
		params.put("erp_no", tContiStudyInfo.getErpNo());
		params.put("user_name", tContiStudyInfo.getUserName());
		params.put("id_card_no", tContiStudyInfo.getIdCardNo());
		params.put("type", tContiStudyInfo.getType());
		params.put("level", tContiStudyInfo.getLevel());
		params.put("creater_id", tContiStudyInfo.getCreaterId());
		params.put("creater_name", tContiStudyInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tContiStudyInfo.getUpdaterId());
		params.put("updater_name", tContiStudyInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tContiStudyInfo.getDelSign());
		params.put("is_valid", tContiStudyInfo.getIsValid());
		params.put("audit_state", tContiStudyInfo.getAuditState());
		params.put("orignal_id", tContiStudyInfo.getOrignalId());
		params.put("flow_status",tContiStudyInfo.getFlowStatus());
		params.put("business_type_id",tContiStudyInfo.getBusinessTypeId());
		params.put("isc_user_id",tContiStudyInfo.getIscUserId());
		params.put("primitive_id",tContiStudyInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TContiStudyInfo getContiStudyInfoById(String id) {
		String sql = "   select t.*, " +
				" GET_DIC('PeixunshoukeType',type) as type_name " +
				" from t_conti_study_info_drafts t where t.id = ? and t.del_sign = '0' " ;
		return this.findUnique(TContiStudyInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TContiStudyInfo> getContiStudyInfoByErpNo(String erpNo) {
		String sql = "   select t.*, " +
				" GET_DIC('PeixunshoukeType',type) as type_name " +
				" from t_conti_study_info_drafts t where t.is_valid='1'  and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by start_time desc");
		return this.findAllBySQL(TContiStudyInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageContiStudyInfoByCondi(Page<TContiStudyInfo> page, TContiStudyInfo tContiStudyInfo) {
		String sql = "   select t.* " +
				" from t_conti_study_info_drafts t where t.is_valid='1'  and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (!StringUtil.isNullOrEmpty(tContiStudyInfo.getErpNo())) {
			sqlBuilder.append(" AND erp_no= ? ");
			arrayList.add(tContiStudyInfo.getErpNo());
		}

		sqlBuilder.append(" order by start_time desc  ");
		this.findPageBySql(TContiStudyInfo.class, sqlBuilder.toString(), page, arrayList.toArray());

    }

    //添加师带徒信息
    @Override
	public void addSdtTutorPrentInfo(TSdtTutorPrentInfo tSdtTutorPrentInfo) {
		String sql = "insert into t_sdt_tutor_prent_info_drafts (id,start_date,end_date,tutor_name,prent_name,teach_summary,erp_no,id_card_no,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{start_date,jdbcType=VARCHAR},")
				.append("#{end_date,jdbcType=VARCHAR},").append("#{tutor_name,jdbcType=VARCHAR},")
				.append("#{prent_name,jdbcType=VARCHAR},").append("#{teach_summary,jdbcType=VARCHAR},")
				.append("#{erp_no,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tSdtTutorPrentInfo.getId());
		params.put("start_date", tSdtTutorPrentInfo.getStartDate());
		params.put("end_date", tSdtTutorPrentInfo.getEndDate());
		params.put("tutor_name", tSdtTutorPrentInfo.getTutorName());
		params.put("prent_name", tSdtTutorPrentInfo.getPrentName());
		params.put("teach_summary", tSdtTutorPrentInfo.getTeachSummary());
		params.put("erp_no", tSdtTutorPrentInfo.getErpNo());
		params.put("id_card_no", tSdtTutorPrentInfo.getIdCardNo());
		params.put("creater_id", tSdtTutorPrentInfo.getCreaterId());
		params.put("creater_name", tSdtTutorPrentInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tSdtTutorPrentInfo.getUpdaterId());
		params.put("updater_name", tSdtTutorPrentInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tSdtTutorPrentInfo.getDelSign());
		params.put("is_valid", tSdtTutorPrentInfo.getIsValid());
		params.put("audit_state", tSdtTutorPrentInfo.getAuditState());
		params.put("orignal_id", tSdtTutorPrentInfo.getOrignalId());
		params.put("flow_status",tSdtTutorPrentInfo.getFlowStatus());
		params.put("business_type_id",tSdtTutorPrentInfo.getBusinessTypeId());
		params.put("isc_user_id",tSdtTutorPrentInfo.getIscUserId());
		params.put("primitive_id",tSdtTutorPrentInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	//徒弟信息添加
	@Override
	public void addSdtPrentInfo(TSdtPrentInfo tSdtPrentInfo) {
		String sql = "insert into t_sdt_prent_info_drafts (id,sdt_id,erp_no,user_name,id_card_no,win_info,award_name,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,orignal_id,flow_status,business_type_id,isc_user_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{sdt_id,jdbcType=VARCHAR},")
				.append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{id_card_no,jdbcType=VARCHAR},").append("#{win_info,jdbcType=VARCHAR},")
				.append("#{award_name,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{orignal_id,jdbcType=VARCHAR},").append("#{flow_status,jdbcType=INTEGER},")
				.append("#{business_type_id,jdbcType=VARCHAR},").append("#{isc_user_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tSdtPrentInfo.getId());
		params.put("sdt_id", tSdtPrentInfo.getSdtId());
		params.put("erp_no", tSdtPrentInfo.getErpNo());
		params.put("user_name", tSdtPrentInfo.getUserName());
		params.put("id_card_no", tSdtPrentInfo.getIdCardNo());
		params.put("win_info", tSdtPrentInfo.getWinInfo());
		params.put("award_name", tSdtPrentInfo.getAwardName());
		params.put("creater_id", tSdtPrentInfo.getCreaterId());
		params.put("creater_name", tSdtPrentInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tSdtPrentInfo.getUpdaterId());
		params.put("updater_name", tSdtPrentInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tSdtPrentInfo.getDelSign());
		params.put("orignal_id", tSdtPrentInfo.getOrignalId());
		params.put("flow_status", tSdtPrentInfo.getOrignalId());
		params.put("business_type_id", tSdtPrentInfo.getOrignalId());
		params.put("isc_user_id", tSdtPrentInfo.getOrignalId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	//徒弟所获奖项添加
	@Override
	public void addSdtAwardInfo(TSdtAward tSdtAward) {
		String sql = "insert into t_sdt_award_drafts (id,item_type,item_id,award,sdt_td_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,orignal_id,flow_status,business_type_id,isc_user_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{item_type,jdbcType=VARCHAR},")
				.append("#{item_id,jdbcType=VARCHAR},").append("#{award,jdbcType=VARCHAR},")
				.append("#{sdt_td_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{orignal_id,jdbcType=VARCHAR},").append("#{flow_status,jdbcType=INTEGER},")
				.append("#{business_type_id,jdbcType=VARCHAR},").append("#{isc_user_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tSdtAward.getId());
		params.put("item_type", tSdtAward.getItemType());
		params.put("item_id", tSdtAward.getItemId());
		params.put("award", tSdtAward.getAward());
		params.put("sdt_td_id", tSdtAward.getSdtTdId());
		params.put("creater_id", tSdtAward.getCreaterId());
		params.put("creater_name", tSdtAward.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tSdtAward.getUpdaterId());
		params.put("updater_name", tSdtAward.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", 0);
		params.put("orignal_id", tSdtAward.getOrignalId());
		params.put("flow_status", tSdtAward.getOrignalId());
		params.put("business_type_id", tSdtAward.getOrignalId());
		params.put("isc_user_id", tSdtAward.getOrignalId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	//参与人员添加
	@Override
	public void addPartRank(TPartRank tPartRank) {
		String sql = "insert into t_part_rank_drafts (id,erp_no,user_name,id_card_no,item_id,item_type,rank,role,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},")
				.append("#{user_name,jdbcType=VARCHAR},").append("#{id_card_no,jdbcType=VARCHAR},")
				.append("#{item_id,jdbcType=VARCHAR},").append("#{item_type,jdbcType=VARCHAR},")
				.append("#{rank,jdbcType=INTEGER},").append("#{role,jdbcType=VARCHAR},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=INTEGER})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tPartRank.getId());
		params.put("erp_no", tPartRank.getErpNo());
		params.put("user_name", tPartRank.getUserName());
		params.put("id_card_no", tPartRank.getIdCardNo());
		params.put("item_id", tPartRank.getItemId());
		params.put("item_type", tPartRank.getItemType());
		params.put("rank", tPartRank.getRank());
		params.put("role", tPartRank.getRole());
		params.put("del_sign", 0);
		params.put("is_valid", tPartRank.getIsValid());
		params.put("audit_state", tPartRank.getAuditState());
		params.put("orignal_id", tPartRank.getOrignalId());
		params.put("flow_status", tPartRank.getOrignalId());
		params.put("business_type_id", tPartRank.getOrignalId());
		params.put("isc_user_id", tPartRank.getOrignalId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TSdtTutorPrentInfo getSdtTutorPrentInfoById(String id) {
		String sql = "   select * from t_sdt_tutor_prent_info_drafts t where t.id = ? and t.del_sign = '0' " ;
		return this.findUnique(TSdtTutorPrentInfo.class, sql, new Object[] { id });
	}

	@Override
	public List<TSdtTutorPrentInfo> getSdtTutorPrentInfoByErpNo(String erpNo) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_sdt_tutor_prent_info_drafts t where t.is_valid='1' and t.del_sign = '0' ");
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND erp_no= ? ");
			arryList.add(erpNo);
		}
		sqlBuilder.append(" order by start_date desc");
		return this.findAllBySQL(TSdtTutorPrentInfo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

	//师带徒根据徒弟表ID获取徒弟所获奖项
	@Override
	public List<TSdtAward> getSdtAwardBySdtTdId(String sdtTdId) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_sdt_award_drafts t where 1=1 ");
		List<String> arryList = new ArrayList<String>();
		sqlBuilder.append(" AND sdt_td_id= ? ");
		arryList.add(sdtTdId);
		return this.findAllBySQL(TSdtAward.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageSdtTutorPrentInfoByCondi(Page<TSdtTutorPrentInfo> page, TSdtTutorPrentInfo tSdtTutorPrentInfo) {
		String sql = "   select * from t_sdt_tutor_prent_info_drafts t where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (!StringUtil.isNullOrEmpty(tSdtTutorPrentInfo.getErpNo())) {
			sqlBuilder.append(" AND erp_no= ? ");
			arrayList.add(tSdtTutorPrentInfo.getErpNo());
		}

		sqlBuilder.append(" order by start_date desc  ");
		this.findPageBySql(TSdtTutorPrentInfo.class, sqlBuilder.toString(), page, arrayList.toArray());
    }

    @Override
	public void addProjAchieveInfo(TProjAchieveInfo tProjAchieveInfo) {
		String sql = "insert into t_proj_achieve_info_drafts (id,start_date,end_date,proj_name,summary,encourage,proj_level,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{start_date,jdbcType=VARCHAR},")
				.append("#{end_date,jdbcType=VARCHAR},").append("#{proj_name,jdbcType=VARCHAR},")
				.append("#{summary,jdbcType=VARCHAR},").append("#{encourage,jdbcType=VARCHAR},")
				.append("#{proj_level,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tProjAchieveInfo.getId());
		params.put("start_date", tProjAchieveInfo.getStartDate());
		params.put("end_date", tProjAchieveInfo.getEndDate());
		params.put("proj_name", tProjAchieveInfo.getProjName());
		params.put("summary", tProjAchieveInfo.getSummary());
		params.put("encourage", tProjAchieveInfo.getEncourage());
		params.put("proj_level", tProjAchieveInfo.getProjLevel());
		params.put("creater_id", tProjAchieveInfo.getCreaterId());
		params.put("creater_name", tProjAchieveInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tProjAchieveInfo.getUpdaterId());
		params.put("updater_name", tProjAchieveInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tProjAchieveInfo.getDelSign());
		params.put("is_valid", tProjAchieveInfo.getIsValid());
		params.put("audit_state", tProjAchieveInfo.getAuditState());
		params.put("orignal_id", tProjAchieveInfo.getOrignalId());
		params.put("flow_status",tProjAchieveInfo.getFlowStatus());
		params.put("business_type_id",tProjAchieveInfo.getBusinessTypeId());
		params.put("isc_user_id",tProjAchieveInfo.getIscUserId());
		params.put("primitive_id",tProjAchieveInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TProjAchieveInfoVo getProjAchieveInfoById(String id) {
		String sql = "   select t.*," +
				" GET_DIC('StandardLevel',t.proj_level) as proj_level_name " +
				" from t_proj_achieve_info_drafts t  " +
				" where t.id = ? and t.del_sign = '0' " ;
		return this.findUnique(TProjAchieveInfoVo.class, sql, new Object[] { id });
	}

	@Override
	public List<TProjAchieveInfoVo> getProjAchieveInfoByErpNo(String erpNo) {
		String sql = "   select t.*,r.role,r.rank,r.erp_no, " +
				"  GET_DIC('XiangMuKeTiJS',r.role) as role_name, " +
				" GET_DIC('StandardLevel',t.proj_level) as proj_level_name " +
				" from t_part_rank_drafts r right join t_proj_achieve_info_drafts t  " +
				" on r.item_id=t.id where r.item_type='17' and  t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		List<String> arryList = new ArrayList<String>();
		if (StringUtils.isNotBlank(erpNo)) {
			sqlBuilder.append(" AND t.creater_id= ? ");
			arryList.add(erpNo);
		}

		sqlBuilder.append(" order by start_date desc");
		return this.findAllBySQL(TProjAchieveInfoVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
	}

    @Override
    public void findPageProjAchieveInfoByCondi(Page<TProjAchieveInfoVo> page, TProjAchieveInfo tProjAchieveInfo) {

		String sql = "select t.* " +
				" from t_proj_achieve_info_drafts t  " +
				" where t.is_valid='1' and t.del_sign = '0' " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();

		StringBuilder erp_no_sb= new StringBuilder();

		if(!tProjAchieveInfo.gettPartRankList().isEmpty()){
			tProjAchieveInfo.gettPartRankList().forEach(tPartRank->{
				if(!StringUtil.isNullOrEmpty(tPartRank.getErpNo())){
					erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
				}
			});
		}

		if(!StringUtil.isNullOrEmpty(erp_no_sb.toString())){
			sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
			//arrayList.add(erp_no_sb.toString().substring(1));
		}
		sqlBuilder.append(" order by start_date desc ");
		this.findPageBySql(TProjAchieveInfoVo.class, sqlBuilder.toString(), page, null);

    }

    @Override
	public List<TMouldInfo> getMouldInfoList(TMouldInfo tMouldInfo) {
		StringBuilder sqlBuilder = new StringBuilder(
				"select ID,MOULD_NAME,TYPE,VALUE,SORT,EASY_NAME,DEL_SIGN,TAB_NAME ");
		sqlBuilder.append(" from t_mould_info where 1=1 and DEL_SIGN=0 ");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (!StringUtil.isNullOrEmpty(tMouldInfo.getId())) {
			sqlBuilder.append("and id=?");
			arrayList.add(tMouldInfo.getId());
		}
		sqlBuilder.append(" order by SORT ");
		return this.findAllBySQL(TMouldInfo.class, sqlBuilder.toString(), null, false,
				arrayList.toArray());
	}

//	@Override
//	public List<EachTypeDetailVo> getEachTypeDetailList(EachTypeDetailVo detail) {
//		StringBuilder sqlBuilder = new StringBuilder(
//				"select * from "+detail.getTabName()+" where 1=1");
//		ArrayList<Object> arrayList = new ArrayList<Object>();
//		return this.findAllBySQL(EachTypeDetailVo.class, sqlBuilder.toString(), null, false,
//				arrayList.toArray());
//	}



	@Override
	public void getEachTypeDetailList(EachTypeDetailVo detail, Page<EachTypeDetailVo> page) {
		ArrayList<Object> arrayList = new ArrayList<Object>();
		StringBuilder sqlBuilder = new StringBuilder(
				"select * from "+detail.getTabName()+" where 1=1 ");
		if(!StringUtil.isNullOrEmpty(detail.getErpNo())) {
			sqlBuilder.append(" and erp_no=?");
			arrayList.add(detail.getErpNo());
		}
		this.findPageBySql(EachTypeDetailVo.class, sqlBuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public List<SysDictionaryInfoVo> getAttendanceUserTypeByValue(String value) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_sys_dictionary_info where p_id=( ");
		sqlBuilder.append(" select id from t_sys_dictionary_info where value=?) order by value");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(value);
		return this.findAllBySQL(SysDictionaryInfoVo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public  List<TPartRank> getTPartRankByMids(List<String> mainIds, String type){
		if(mainIds.isEmpty()||StringUtil.isNullOrEmpty(type)){
			return null;
		}
		String idsStr="";
		for(int i=0;i<mainIds.size();i++){
			idsStr+=",'"+mainIds.get(i)+"'";
		}

		idsStr=idsStr.substring(1);

		String jsCode="";
		if(type.equals("17")){
			jsCode="XiangMuKeTiJS";
		}else if(type.equals("21")){ //技术标准
			jsCode="tecStandardRole";
		}else {
			jsCode="XueshuchengguoJs";
		}

//		String sql = " select t.id,t.erp_no,p.user_name,t.id_card_no,t.item_id,t.item_type,t.rank,t.role,t.del_sign,t.is_valid, " +
//				" t.audit_state,t.orignal_id,t.flow_status,t.business_type_id,t.isc_user_id , " +
//				" GET_DIC('"+ jsCode +"',t.role) as role_name from t_part_rank_drafts t left join isc_user i on t.erp_no=i.fax " ;

		String sql = " select t.* ,GET_DIC('"+ jsCode +"',t.role) as role_name from t_part_rank_drafts t  " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" where item_id in (").append(idsStr).append(") and item_type='").append(type).append("' order by item_type, rank ");
		return this.findAllBySQL(TPartRank.class, sqlBuilder.toString(), null, false,null);

	}

	public List<TSdtPrentInfo> getTSdtPrentInfoByMids(List<String> mainIds){

		if(mainIds.isEmpty()){
			return null;
		}
		String idsStr="";
		for(int i=0;i<mainIds.size();i++){
			idsStr+=",'"+mainIds.get(i)+"'";
		}

		idsStr=idsStr.substring(1);


//		String sql =" select t.id,t.sdt_id,t.erp_no,p.user_name,t.id_card_no,t.win_info,t.award_name, " +
//				" t.creater_id,t.creater_name,t.create_time,t.updater_id,t.updater_name,t.update_time,t.del_sign, " +
//				" t.orignal_id,t.flow_status,t.business_type_id,t.isc_user_id from t_sdt_prent_info t left join isc_user i on t.erp_no=i.fax " ;

		String sql =" select * from t_sdt_prent_info_drafts " ;

		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" where sdt_id in (").append(idsStr).append(")  order by erp_no ");

		return this.findAllBySQL(TSdtPrentInfo.class, sqlBuilder.toString(), null, false,null);

	}

	@Override
	public List<TSdtAward> getTSdtAwardByMids(List<String> mainIds) {
		if(mainIds.isEmpty()){
			return null;
		}
		String idsStr="";
		for(int i=0;i<mainIds.size();i++){
			idsStr+=",'"+mainIds.get(i)+"'";
		}

		idsStr=idsStr.substring(1);
		String sql =" select * from t_sdt_award_drafts " ;

		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" where sdt_td_id in (").append(idsStr).append(")  order by item_type ");

		return this.findAllBySQL(TSdtAward.class, sqlBuilder.toString(), null, false,null);
	}

	/**
	 * 根据师带徒ID获取徒弟信息
	 * @param sdtId
	 * @return
	 */
	public List<TSdtPrentInfo> getTSdtPrentInfoListById(String sdtId){
		if(sdtId.isEmpty()){
			return null;
		}
		String sql =" select * from t_sdt_prent_info_drafts " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" where sdt_id =? ");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(sdtId);
		return this.findAllBySQL(TSdtPrentInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}


	/****************************************通过数据id判断当前数据是否存在待审核的副本数据********************************/

	@Override
	public List<TYearEffectInfo> getReadyYearEffectById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_year_effect_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TYearEffectInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TEducateInfo> getReadyEducateInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_educate_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TEducateInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TProTecInfo> getReadyProTecInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_pro_tec_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TProTecInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TSkillLevelInfo> getReadySkillLevelInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_skill_level_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TSkillLevelInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TExpertTitleInfo> getReadyExpertTitleInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_expert_title_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TExpertTitleInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TAcadeAchiveInfo> getReadyAcadeAchiveInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_acade_achive_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TAcadeAchiveInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TStandInfo> getReadyStandInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_stand_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TStandInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TPatentInfo> getReadyPatentInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_patent_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TPatentInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TTecInnovInfo> getReadyTecInnovInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_tec_innov_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TTecInnovInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TContestInfo> getReadyContestInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_contest_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TContestInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TTecManInnov> getReadyTecManInnovById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_tec_man_innov_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TTecManInnov.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<THonorInfo> getReadyHonorInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_honor_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(THonorInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TWorkExpInfo> getReadyWorkExpInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_work_exp_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TWorkExpInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TContiStudyInfo> getReadyContiStudyInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_conti_study_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TContiStudyInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TSdtTutorPrentInfo> getReadySdtTutorPrentInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_sdt_tutor_prent_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TSdtTutorPrentInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public List<TProjAchieveInfo> getReadyProjAchieveInfoById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select * from t_proj_achieve_info_drafts where 1=1 ");
		sqlBuilder.append(" and orignal_id = ?");
		sqlBuilder.append(" and flow_status = 0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		arrayList.add(id);
		return this.findAllBySQL(TProjAchieveInfo.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public void deleteEmpBaseInfoByErpNo(String erpNo) {
		String sql = "UPDATE t_emp_base_info_drafts  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		sqlBuilder.append(" del_sign = 1 ");
		sqlBuilder.append(" where 1=1 ");
		sqlBuilder.append(" and erp_no = #{erp_no,jdbcType=VARCHAR} ");
		params.put("erp_no",erpNo);
		this.executeSql(sqlBuilder.toString(), params);
	}
	
	/**
	 * 添加挂职轮岗信息
	 * @author yangwang
	 * @param tRotationInfo
	 *  */
	@Override
	public void addRotationInfo(TRotationInfo tRotationInfo) {
		String sql = "insert into t_rotation_info_drafts (id,erp_no,user_name,start_time,end_time,rotation_dept,rotation_org,rotation_post,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
				.append("#{start_time,jdbcType=DATE},").append("#{end_time,jdbcType=DATE},")
				.append("#{rotation_dept,jdbcType=VARCHAR},").append("#{rotation_org,jdbcType=VARCHAR},")
				.append("#{rotation_post,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
				.append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
				.append("#{flow_status,jdbcType=INTEGER},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{isc_user_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tRotationInfo.getId());
		params.put("erp_no", tRotationInfo.getErpNo());
		params.put("user_name", tRotationInfo.getUserName());
		params.put("start_time", tRotationInfo.getStartTime());
		params.put("end_time", tRotationInfo.getEndTime());
		params.put("rotation_dept", tRotationInfo.getRotationDept());
		params.put("rotation_org", tRotationInfo.getRotationOrg());
		params.put("rotation_post", tRotationInfo.getRotationPost());
		params.put("creater_id", tRotationInfo.getCreaterId());
		params.put("creater_name", tRotationInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tRotationInfo.getUpdaterId());
		params.put("updater_name", tRotationInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tRotationInfo.getDelSign());
		params.put("is_valid", tRotationInfo.getIsValid());
		params.put("audit_state", tRotationInfo.getAuditState());
		params.put("orignal_id", tRotationInfo.getOrignalId());
		params.put("flow_status",tRotationInfo.getFlowStatus());
		params.put("business_type_id",tRotationInfo.getBusinessTypeId());
		params.put("isc_user_id",tRotationInfo.getIscUserId());
		params.put("primitive_id",tRotationInfo.getPrimitiveId());
		this.executeSql(sqlBuilder.toString(), params);
	}
	/**
	 * 根据id获取挂职轮岗信息
	 * @author yangwang
	 * @param id
	 * @return TRotationInfo
	 *  */
	@Override
	public TRotationInfo getRotationInfoById(String id) {
		String sql = "select id,start_time,end_time,rotation_dept,rotation_org,rotation_post,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" from t_rotation_info_drafts")
		.append(" where del_sign = '0'")
		.append(" and id= ?");
		
		return this.findUnique(TRotationInfo.class, sqlBuilder.toString(), new Object[] { id });
	}
	/**
	 * 获取挂职轮岗列表信息
	 * @author yangwang
	 * @param tRotationInfo
	 * @return List<TRotationInfo>
	 *  */
	@Override
	public List<TRotationInfo> getListRotationInfoByCondi(TRotationInfo tRotationInfo) {
		String sql = "select distinct id,start_time,end_time,rotation_dept,rotation_org,rotation_post,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" from t_rotation_info_drafts")
		.append(" where del_sign = '0'")
		.append(" and is_valid='0'");
		
		List<Object> paramList = new ArrayList<Object>();
		if(null != tRotationInfo) {
			if(StringUtils.isNotBlank(tRotationInfo.getRotationDept())) {
				sqlBuilder.append(" and rotation_dept LIKE concat('%',?,'%') ESCAPE '/'");
		        String replaceStr = tRotationInfo.getRotationDept().replaceAll("%", "/%").replaceAll("_", "/_");
		        paramList.add(replaceStr);
			}
			if(StringUtils.isNotBlank(tRotationInfo.getRotationOrg())) {
				sqlBuilder.append(" and rotation_org LIKE concat('%',?,'%') ESCAPE '/'");
		        String replaceStr = tRotationInfo.getRotationOrg().replaceAll("%", "/%").replaceAll("_", "/_");
		        paramList.add(replaceStr);
			}
			if(StringUtils.isNotBlank(tRotationInfo.getRotationPost())) {
				sqlBuilder.append(" and rotation_post LIKE concat('%',?,'%') ESCAPE '/'");
		        String replaceStr = tRotationInfo.getRotationPost().replaceAll("%", "/%").replaceAll("_", "/_");
		        paramList.add(replaceStr);
			}
			if(null != tRotationInfo.getStartTime()) {
				sqlBuilder.append(" and start_time >= ?");
    			paramList.add(new Timestamp(tRotationInfo.getStartTime().getTime()));
			}
			if(null != tRotationInfo.getEndTime()) {
				sqlBuilder.append(" and end_time <= ?");
    			paramList.add(new Timestamp(tRotationInfo.getEndTime().getTime()));
			}
		}

		sqlBuilder.append(" order by update_time desc");
		
		return this.findAllBySQL(TRotationInfo.class, sqlBuilder.toString(), null, false, paramList.toArray());
	}
	/**
	 * 获取挂职轮岗分页信息
	 * @author yangwang
	 * @param page
	 * @param tRotationInfo
	 *  */
	@Override
	public void findPageRotationInfoByCondi(Page<TRotationInfo> page,TRotationInfo tRotationInfo) {
		String sql = "select distinct id,start_time,end_time,rotation_dept,rotation_org,rotation_post,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" from t_rotation_info_drafts")
		.append(" where del_sign = '0'")
		.append(" and is_valid='1'");
		
		List<Object> paramList = new ArrayList<Object>();
		if(null != tRotationInfo) {
			if (!StringUtil.isNullOrEmpty(tRotationInfo.getErpNo())) {
				sqlBuilder.append(" AND erp_no= ? ");
				paramList.add(tRotationInfo.getErpNo());
			}
			if(StringUtils.isNotBlank(tRotationInfo.getRotationDept())) {
				sqlBuilder.append(" and rotation_dept LIKE concat('%',?,'%') ESCAPE '/'");
		        String replaceStr = tRotationInfo.getRotationDept().replaceAll("%", "/%").replaceAll("_", "/_");
		        paramList.add(replaceStr);
			}
			if(StringUtils.isNotBlank(tRotationInfo.getRotationOrg())) {
				sqlBuilder.append(" and rotation_org LIKE concat('%',?,'%') ESCAPE '/'");
		        String replaceStr = tRotationInfo.getRotationOrg().replaceAll("%", "/%").replaceAll("_", "/_");
		        paramList.add(replaceStr);
			}
			if(StringUtils.isNotBlank(tRotationInfo.getRotationPost())) {
				sqlBuilder.append(" and rotation_post LIKE concat('%',?,'%') ESCAPE '/'");
		        String replaceStr = tRotationInfo.getRotationPost().replaceAll("%", "/%").replaceAll("_", "/_");
		        paramList.add(replaceStr);
			}
			if(null != tRotationInfo.getStartTime()) {
				sqlBuilder.append(" and start_time >= ?");
    			paramList.add(new Timestamp(tRotationInfo.getStartTime().getTime()));
			}
			if(null != tRotationInfo.getEndTime()) {
				sqlBuilder.append(" and end_time <= ?");
    			paramList.add(new Timestamp(tRotationInfo.getEndTime().getTime()));
			}
		}

		sqlBuilder.append(" order by update_time desc");
		
		this.findPageBySql(TRotationInfo.class, sqlBuilder.toString(), page, paramList.toArray());
	}
	
	/**
	 * 获取挂职轮岗待审核信息
	 * @author yangwang
	 * @param id
	 * @return List<TRotationInfo>
	 *  */
	@Override
	public List<TRotationInfo> getReadyRotationInfoById(String id){
		String sql = "select distinct id,start_time,end_time,rotation_dept,rotation_org,rotation_post,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,flow_status,business_type_id,isc_user_id,primitive_id";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" from t_rotation_info_drafts")
		.append(" where flow_status = 0")
		.append(" and orignal_id = ?");
		
		return this.findAllBySQL(TRotationInfo.class, sqlBuilder.toString(), null, false, new Object[] {id});
	}

	@Override
	public void updateEducateInfoYes(TEducateInfo educateInfo, User user) {
		String sql = "UPDATE t_educate_info_drafts  SET "; 
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
			sqlBuilder.append(" start_time=#{start_time,jdbcType=VARCHAR},");
			sqlBuilder.append(" end_time=#{end_time,jdbcType=VARCHAR},");
			sqlBuilder.append(" acqu_time=#{acqu_time,jdbcType=DATE}, ");
			sqlBuilder.append(" grad_school=#{grad_school,jdbcType=DATE}, ");
			sqlBuilder.append(" school_type=#{school_type,jdbcType=INTEGER}, ");
			sqlBuilder.append(" major=#{major,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" educ_name=#{educ_name,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" degree_name=#{degree_name,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" is_cont_educ=#{is_cont_educ,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" is_employ_educ=#{is_employ_educ,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" is_highest_educ=#{is_highest_educ,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" user_name=#{user_name,jdbcType=DOUBLE}, ");
			sqlBuilder.append(" id_card_no=#{id_card_no,jdbcType=DOUBLE}, ");
			sqlBuilder.append(" updater_id=#{updater_id,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" updater_name=#{updater_name,jdbcType=VARCHAR}, ");
			sqlBuilder.append(" update_time=#{update_time,jdbcType=DATE} ");
			sqlBuilder.append(" where id=#{id,jdbcType=VARCHAR} ");
			
			params.put("start_time", educateInfo.getStartTime());
			params.put("end_time", educateInfo.getEndTime());
			params.put("acqu_time", educateInfo.getAcquTime());
			params.put("grad_school", educateInfo.getGradSchool());
			params.put("school_type", educateInfo.getSchoolType());
			params.put("major", educateInfo.getMajor());
			params.put("educ_name", educateInfo.getEducName());
			params.put("degree_name", educateInfo.getDegreeName());
			params.put("is_cont_educ", educateInfo.getIsContEduc());
			params.put("is_employ_educ", educateInfo.getIsEmployEduc());
			params.put("is_highest_educ", educateInfo.getIsHighestEduc());
			params.put("user_name", educateInfo.getUserName());
			params.put("id_card_no", educateInfo.getIdCardNo());
			params.put("updater_id", user.getFax());
			params.put("updater_name", user.getUserName());
			params.put("update_time", new Timestamp(new Date().getTime()));
			params.put("id", educateInfo.getId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void updateContiStudyInfo(TContiStudyInfo tContiStudyInfo) {
		 String sql = "update t_conti_study_info_drafts set ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        sqlBuilder
	                .append("start_time=#{start_time,jdbcType=VARCHAR},")
	                .append("end_time=#{end_time,jdbcType=VARCHAR},")
	                .append("major=#{major,jdbcType=VARCHAR},")
	                .append("study_place=#{study_place,jdbcType=VARCHAR},")
	                .append("certifier=#{certifier,jdbcType=VARCHAR},")
	                .append("erp_no=#{erp_no,jdbcType=VARCHAR},")
	                .append("user_name=#{user_name,jdbcType=VARCHAR},")
	                .append("id_card_no=#{id_card_no,jdbcType=VARCHAR},")
	                .append("type=#{type,jdbcType=VARCHAR},")
	                .append("level=#{level,jdbcType=VARCHAR},")
	                .append("updater_id=#{updater_id,jdbcType=VARCHAR},")
	                .append("updater_name=#{updater_name,jdbcType=VARCHAR},")
	                .append("update_time=now()");
	        sqlBuilder.append(" where 1=1 ");
	        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
	        Map<String, Object> params = new HashMap<String, Object>();
	        params.put("id", tContiStudyInfo.getId());
	        params.put("start_time", tContiStudyInfo.getStartTime());
	        params.put("end_time", tContiStudyInfo.getEndTime());
	        params.put("major", tContiStudyInfo.getMajor());
	        params.put("study_place", tContiStudyInfo.getStudyPlace());
	        params.put("certifier", tContiStudyInfo.getCertifier());
	        params.put("erp_no", tContiStudyInfo.getErpNo());
	        params.put("user_name", tContiStudyInfo.getUserName());
	        params.put("id_card_no", tContiStudyInfo.getIdCardNo());
	        params.put("type", tContiStudyInfo.getType());
	        params.put("level", tContiStudyInfo.getLevel());
	        params.put("updater_id", tContiStudyInfo.getUpdaterId());
	        params.put("updater_name", tContiStudyInfo.getUpdaterName());

	        this.executeSql(sqlBuilder.toString(),params);
		
		
	}

	@Override
	public void updateTProTecInfo(TProTecInfo tProTecInfo) {
		String sql = "update t_pro_tec_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder
                .append("user_name=#{user_name,jdbcType=VARCHAR},")
                .append("id_card_no=#{id_card_no,jdbcType=VARCHAR},")
                .append("acqu_time=#{acqu_time,jdbcType=VARCHAR},")
                .append("subj_name=#{subj_name,jdbcType=VARCHAR},")
                .append("subj_set=#{subj_set,jdbcType=VARCHAR},")
                .append("subj_level=#{subj_level,jdbcType=VARCHAR},")
                .append("audit_org=#{audit_org,jdbcType=VARCHAR},")
                .append("org_level=#{org_level,jdbcType=VARCHAR},")
                .append("cert_no=#{cert_no,jdbcType=VARCHAR},")
                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
                .append("update_time = now() ");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tProTecInfo.getId());
        params.put("user_name", tProTecInfo.getUserName());
        params.put("id_card_no", tProTecInfo.getIdCardNo());
        params.put("acqu_time", tProTecInfo.getAcquTime());
        params.put("subj_name", tProTecInfo.getSubjName());
        params.put("subj_set", tProTecInfo.getSubjSet());
        params.put("subj_level", tProTecInfo.getSubjLevel());
        params.put("audit_org", tProTecInfo.getAuditOrg());
        params.put("org_level", tProTecInfo.getOrgLevel());
        params.put("cert_no", tProTecInfo.getCertNo());
        params.put("updater_id", tProTecInfo.getUpdaterId());
        params.put("updater_name", tProTecInfo.getUpdaterName());
        this.executeSql(sqlBuilder.toString(),params);	
	}

	@Override
	public void updateTSkillLevelInfo(TSkillLevelInfo tSkillLevelInfo) {
		String sql = "update t_skill_level_info_drafts set  ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder
                .append("user_name = #{user_name,jdbcType=VARCHAR},")
                .append("id_card_no = #{id_card_no,jdbcType=VARCHAR},")
                .append("acqu_time = #{acqu_time,jdbcType=VARCHAR},")
                .append("tech_type = #{tech_type,jdbcType=VARCHAR},")
                .append("qualifi_level = #{qualifi_level,jdbcType=VARCHAR},")
                .append("audit_org = #{audit_org,jdbcType=VARCHAR},")
                .append("org_level = #{org_level,jdbcType=VARCHAR},")
                .append("cert_no = #{cert_no,jdbcType=VARCHAR},")
                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
                .append("update_time = now() ");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tSkillLevelInfo.getId());
        params.put("user_name", tSkillLevelInfo.getUserName());
        params.put("id_card_no", tSkillLevelInfo.getIdCardNo());
        params.put("acqu_time", tSkillLevelInfo.getAcquTime());
        params.put("tech_type", tSkillLevelInfo.getTechType());
        params.put("qualifi_level", tSkillLevelInfo.getQualifiLevel());
        params.put("audit_org", tSkillLevelInfo.getAuditOrg());
        params.put("org_level", tSkillLevelInfo.getOrgLevel());
        params.put("cert_no", tSkillLevelInfo.getCertNo());
        params.put("updater_id", tSkillLevelInfo.getUpdaterId());
        params.put("updater_name", tSkillLevelInfo.getUpdaterName());

        this.executeSql(sqlBuilder.toString(),params);		
	}

	@Override
	public void updateTExpertTitleInfo(TExpertTitleInfo tExpertTitleInfo) {
		String sql = "update t_expert_title_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder
                .append("user_name=#{user_name,jdbcType=VARCHAR},")
                .append("id_card_no=#{id_card_no,jdbcType=VARCHAR},")
                .append("major=#{major,jdbcType=VARCHAR},")
                .append("acqu_time=#{acqu_time,jdbcType=VARCHAR},")
                .append("level_name=#{level_name,jdbcType=VARCHAR},")
                .append("type=#{type,jdbcType=VARCHAR},")
                .append("emp_term_start=#{emp_term_start,jdbcType=VARCHAR},")
                .append("emp_term_end=#{emp_term_end,jdbcType=VARCHAR},")
                .append("emp_title=#{emp_title,jdbcType=VARCHAR},")
                .append("updater_id=#{updater_id,jdbcType=VARCHAR},")
                .append("updater_name=#{updater_name,jdbcType=VARCHAR},")
                .append("update_time=now()");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tExpertTitleInfo.getId());
        params.put("user_name", tExpertTitleInfo.getUserName());
        params.put("id_card_no", tExpertTitleInfo.getIdCardNo());
        params.put("major", tExpertTitleInfo.getMajor());
        params.put("acqu_time", tExpertTitleInfo.getAcquTime());
        params.put("level_name", tExpertTitleInfo.getLevelName());
        params.put("type", tExpertTitleInfo.getType());
        params.put("emp_term_start", tExpertTitleInfo.getEmpTermStart());
        params.put("emp_term_end", tExpertTitleInfo.getEmpTermEnd());
        params.put("emp_title", tExpertTitleInfo.getEmpTitle());
        params.put("updater_id", tExpertTitleInfo.getUpdaterId());
        params.put("updater_name", tExpertTitleInfo.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTAcadeAchiveInfo(TAcadeAchiveInfo tAcadeAchiveInfo) {
		 String sql = "update t_acade_achive_info_drafts set ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        sqlBuilder.append("pub_time = #{pub_time,jdbcType=VARCHAR},")
	                .append("acad_type = #{acad_type,jdbcType=VARCHAR},")
	                .append("acad_name = #{acad_name,jdbcType=VARCHAR},")
	                .append("summary = #{summary,jdbcType=VARCHAR},")
	                .append("pub_name = #{pub_name,jdbcType=VARCHAR},")
	                .append("issn = #{issn,jdbcType=VARCHAR},")
	                .append("periodic_no = #{periodic_no,jdbcType=VARCHAR},")
	                .append("page = #{page,jdbcType=VARCHAR},")
	                .append("publisher = #{publisher,jdbcType=VARCHAR},")
	                .append("level = #{level,jdbcType=VARCHAR},")
	                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
	                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
	                .append("update_time = now() ");
	        sqlBuilder.append(" where 1=1 ");
	        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
	        Map<String, Object> params = new HashMap<String, Object>();
	        params.put("id", tAcadeAchiveInfo.getId());
	        params.put("pub_time", tAcadeAchiveInfo.getPubTime());
	        params.put("acad_type", tAcadeAchiveInfo.getAcadType());
	        params.put("acad_name", tAcadeAchiveInfo.getAcadName());
	        params.put("summary", tAcadeAchiveInfo.getSummary());
	        params.put("pub_name", tAcadeAchiveInfo.getPubName());
	        params.put("issn", tAcadeAchiveInfo.getIssn());
	        params.put("periodic_no", tAcadeAchiveInfo.getPeriodicNo());
	        params.put("page", tAcadeAchiveInfo.getPage());
	        params.put("publisher", tAcadeAchiveInfo.getPublisher());
	        params.put("level", tAcadeAchiveInfo.getLevel());
	        params.put("creater_id", tAcadeAchiveInfo.getCreaterId());
	        params.put("creater_name", tAcadeAchiveInfo.getCreaterName());
	        params.put("create_time", new Timestamp(new Date().getTime()));
	        params.put("updater_id", tAcadeAchiveInfo.getUpdaterId());
	        params.put("updater_name", tAcadeAchiveInfo.getUpdaterName());
	        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTStandInfo(TStandInfo tStandInfo) {
		 String sql = "update t_stand_info_drafts set ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        sqlBuilder.append("issue_time = #{issue_time,jdbcType=VARCHAR},")
	                .append("name = #{name,jdbcType=VARCHAR},")
	                .append("type = #{type,jdbcType=VARCHAR},")
	                .append("level = #{level,jdbcType=VARCHAR},")
	                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
	                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
	                .append("update_time = now() ");
	        sqlBuilder.append(" where 1=1 ");
	        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
	        Map<String, Object> params = new HashMap<String, Object>();
	        params.put("id", tStandInfo.getId());
	        params.put("issue_time", tStandInfo.getIssueTime());
	        params.put("name", tStandInfo.getName());
	        params.put("type", tStandInfo.getType());
	        params.put("level", tStandInfo.getLevel());
	        params.put("updater_id", tStandInfo.getUpdaterId());
	        params.put("updater_name", tStandInfo.getUpdaterName());
	        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTPatentInfo(TPatentInfo tPatentInfo) {
		String sql = "update t_patent_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("patent_name = #{patent_name,jdbcType=VARCHAR},")
                .append("patent_no = #{patent_no,jdbcType=VARCHAR},")
                .append("patent_type = #{patent_type,jdbcType=VARCHAR},")
                .append("apply_date = #{apply_date,jdbcType=VARCHAR},")
                .append("decl_date = #{decl_date,jdbcType=VARCHAR},")
                .append("inventor = #{inventor,jdbcType=VARCHAR},")
                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
                .append("update_time = now() ");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tPatentInfo.getId());
        params.put("patent_name", tPatentInfo.getPatentName());
        params.put("patent_no", tPatentInfo.getPatentNo());
        params.put("patent_type", tPatentInfo.getPatentType());
        params.put("apply_date", tPatentInfo.getApplyDate());
        params.put("decl_date", tPatentInfo.getDeclDate());
        params.put("inventor", tPatentInfo.getInventor());
        params.put("updater_id", tPatentInfo.getUpdaterId());
        params.put("updater_name", tPatentInfo.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTTecInnovInfo(TTecInnovInfo tTecInnovInfo) {
		String sql = "update t_tec_innov_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("achi_name = #{achi_name,jdbcType=VARCHAR},")
                .append("sumary = #{sumary,jdbcType=VARCHAR},")
                .append("award_name = #{award_name,jdbcType=VARCHAR},")
                .append("award_date = #{award_date,jdbcType=VARCHAR},")
                .append("award_org = #{award_org,jdbcType=VARCHAR},")
                .append("award_level = #{award_level,jdbcType=VARCHAR},")
                .append("award_grade = #{award_grade,jdbcType=VARCHAR},")
                .append("group_name = #{group_name,jdbcType=VARCHAR},")
                .append("member_name = #{member_name,jdbcType=VARCHAR},")
                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
                .append("update_time = now()");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tTecInnovInfo.getId());
        params.put("achi_name", tTecInnovInfo.getAchiName());
        params.put("sumary", tTecInnovInfo.getSumary());
        params.put("award_name", tTecInnovInfo.getAwardName());
        params.put("award_date", tTecInnovInfo.getAwardDate());
        params.put("award_org", tTecInnovInfo.getAwardOrg());
        params.put("award_level", tTecInnovInfo.getAwardLevel());
        params.put("award_grade", tTecInnovInfo.getAwardGrade());
        params.put("group_name", tTecInnovInfo.getGroupName());
        params.put("member_name", tTecInnovInfo.getMemberName());
        params.put("updater_id", tTecInnovInfo.getUpdaterId());
        params.put("updater_name", tTecInnovInfo.getUpdaterName());
        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTContestInfo(TContestInfo tContestInfo) {
		String sql = "update t_contest_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("user_name = #{user_name,jdbcType=VARCHAR},")
                .append("id_card_no = #{id_card_no,jdbcType=VARCHAR},")
                .append("award_date = #{award_date,jdbcType=VARCHAR},")
                .append("comp_name = #{comp_name,jdbcType=VARCHAR},")
                .append("host_org = #{host_org,jdbcType=VARCHAR},")
                .append("award_name = #{award_name,jdbcType=VARCHAR},")
                .append("award_level = #{award_level,jdbcType=VARCHAR},")
                .append("comp_rank = #{comp_rank,jdbcType=VARCHAR},")
                .append("get_title = #{get_title,jdbcType=VARCHAR},")
                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
                .append("update_time = now() ");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tContestInfo.getId());
        params.put("user_name", tContestInfo.getUserName());
        params.put("id_card_no", tContestInfo.getIdCardNo());
        params.put("award_date", tContestInfo.getAwardDate());
        params.put("comp_name", tContestInfo.getCompName());
        params.put("host_org", tContestInfo.getHostOrg());
        params.put("award_name", tContestInfo.getAwardName());
        params.put("award_level", tContestInfo.getAwardLevel());
        params.put("comp_rank", tContestInfo.getCompRank());
        params.put("get_title", tContestInfo.getGetTitle());
        params.put("updater_id", tContestInfo.getUpdaterId());
        params.put("updater_name", tContestInfo.getUpdaterName());
        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTTecManInnov(TTecManInnov tTecManInnov) {
		 String sql = "update t_tec_man_innov_drafts set ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        sqlBuilder.append("achi_name = #{achi_name,jdbcType=VARCHAR},")
	                .append("achi_type = #{achi_type,jdbcType=VARCHAR},")
	                .append("summary = #{summary,jdbcType=VARCHAR},")
	                .append("award_name = #{award_name,jdbcType=VARCHAR},")
	                .append("award_date = #{award_date,jdbcType=VARCHAR},")
	                .append("award_org = #{award_org,jdbcType=VARCHAR},")
	                .append("award_level = #{award_level,jdbcType=VARCHAR},")
	                .append("award_grade = #{award_grade,jdbcType=VARCHAR},")
	                .append("group_name = #{group_name,jdbcType=VARCHAR},")
	                .append("member_name = #{member_name,jdbcType=VARCHAR},")
	                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
	                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
	                .append("update_time = now()");
	        sqlBuilder.append(" where 1=1 ");
	        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
	        Map<String, Object> params = new HashMap<String, Object>();
	        params.put("id", tTecManInnov.getId());
	        params.put("achi_name", tTecManInnov.getAchiName());
	        params.put("achi_type", tTecManInnov.getAchiType());
	        params.put("summary", tTecManInnov.getSummary());
	        params.put("award_name", tTecManInnov.getAwardName());
	        params.put("award_date", tTecManInnov.getAwardDate());
	        params.put("award_org", tTecManInnov.getAwardOrg());
	        params.put("award_level", tTecManInnov.getAwardLevel());
	        params.put("award_grade", tTecManInnov.getAwardGrade());
	        params.put("group_name", tTecManInnov.getGroupName());
	        params.put("member_name", tTecManInnov.getMemberName());
	        params.put("updater_id", tTecManInnov.getUpdaterId());
	        params.put("updater_name", tTecManInnov.getUpdaterName());
	        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTHonorInfo(THonorInfo tHonorInfo) {
		String sql = "update  t_honor_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("user_name = #{user_name,jdbcType=VARCHAR},")
                .append("id_card_no = #{id_card_no,jdbcType=VARCHAR},")
                .append("acqu_time = #{acqu_time,jdbcType=VARCHAR},")
                .append("honor_title = #{honor_title,jdbcType=VARCHAR},")
                .append("award_org = #{award_org,jdbcType=VARCHAR},")
                .append("honor_level = #{honor_level,jdbcType=VARCHAR},")
                .append("honor_type = #{honor_type,jdbcType=VARCHAR},")
                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
                .append("update_time = now() ");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tHonorInfo.getId());
        params.put("user_name", tHonorInfo.getUserName());
        params.put("id_card_no", tHonorInfo.getIdCardNo());
        params.put("acqu_time", tHonorInfo.getAcquTime());
        params.put("honor_title", tHonorInfo.getHonorTitle());
        params.put("award_org", tHonorInfo.getAwardOrg());
        params.put("honor_level", tHonorInfo.getHonorLevel());
        params.put("honor_type", tHonorInfo.getHonorType());
        params.put("updater_id", tHonorInfo.getUpdaterId());
        params.put("updater_name", tHonorInfo.getUpdaterName());

        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTProjAchieveInfo(TProjAchieveInfo tProjAchieveInfo) {
		String sql = "update t_proj_achieve_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("start_date = #{start_date,jdbcType=VARCHAR},")
                .append("end_date = #{end_date,jdbcType=VARCHAR},")
                .append("proj_name = #{proj_name,jdbcType=VARCHAR},")
                .append("summary = #{summary,jdbcType=VARCHAR},")
                .append("proj_level = #{proj_level,jdbcType=VARCHAR},")
                .append("encourage = #{encourage,jdbcType=VARCHAR},")
                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
                .append("update_time = now()");

        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tProjAchieveInfo.getId());
        params.put("start_date", tProjAchieveInfo.getStartDate());
        params.put("end_date", tProjAchieveInfo.getEndDate());
        params.put("proj_name", tProjAchieveInfo.getProjName());
        params.put("summary", tProjAchieveInfo.getSummary());
        params.put("proj_level", tProjAchieveInfo.getProjLevel());
        params.put("encourage", tProjAchieveInfo.getEncourage());
        params.put("updater_id", tProjAchieveInfo.getUpdaterId());
        params.put("updater_name", tProjAchieveInfo.getUpdaterName());
        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTSdtTutorPrentInfo(TSdtTutorPrentInfo tSdtTutorPrentInfo) {
		 String sql = "update t_sdt_tutor_prent_info_drafts set ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        sqlBuilder.append("start_date = #{start_date,jdbcType=VARCHAR},")
	                .append("end_date = #{end_date,jdbcType=VARCHAR},")
	                .append("tutor_name = #{tutor_name,jdbcType=VARCHAR},")
	                .append("prent_name = #{prent_name,jdbcType=VARCHAR},")
	                .append("teach_summary = #{teach_summary,jdbcType=VARCHAR},")
	                .append("id_card_no =#{id_card_no,jdbcType=VARCHAR},")
	                .append("updater_id = #{updater_id,jdbcType=VARCHAR},")
	                .append("updater_name = #{updater_name,jdbcType=VARCHAR},")
	                .append("update_time = now()");
	        sqlBuilder.append(" where 1=1 ");
	        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");

	        Map<String, Object> params = new HashMap<String, Object>();
	        params.put("id", tSdtTutorPrentInfo.getId());
	        params.put("start_date", tSdtTutorPrentInfo.getStartDate());
	        params.put("end_date", tSdtTutorPrentInfo.getEndDate());
	        params.put("tutor_name", tSdtTutorPrentInfo.getTutorName());
	        params.put("prent_name", tSdtTutorPrentInfo.getPrentName());
	        params.put("teach_summary", tSdtTutorPrentInfo.getTeachSummary());
	        params.put("id_card_no", tSdtTutorPrentInfo.getIdCardNo());
	        params.put("updater_id", tSdtTutorPrentInfo.getUpdaterId());
	        params.put("updater_name", tSdtTutorPrentInfo.getUpdaterName());
	        this.executeSql(sqlBuilder.toString(),params);		
	}

	@Override
	public void deleteTSdtAwardBySdtTdId(String sdtId) {
		 String sql = "delete from t_sdt_award_drafts ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        sqlBuilder.append(" where 1=1 ");
	        Map<String, Object> params = new HashMap<String, Object>();
	        sqlBuilder.append(" and sdt_td_id=#{sdtTdId,jdbcType=VARCHAR}");
	        params.put("sdtTdId", sdtId);
	        this.executeSql(sqlBuilder.toString(), params);		
	}

	@Override
	public void deleteTSdtPrentInfoByCondition(String orgId, String sdtId) {
		 String sql = "delete from t_sdt_prent_info_drafts ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        sqlBuilder.append(" where 1=1 ");
	        Map<String, Object> params = new HashMap<String, Object>();
	        if(StringUtils.isNotBlank(orgId)){
	            sqlBuilder.append(" and org_id=#{orgId,jdbcType=VARCHAR}");
	            params.put("orgId",orgId);
	        }
	        if(StringUtils.isNotBlank(sdtId)){
	            sqlBuilder.append(" and sdt_id=#{sdtId,jdbcType=VARCHAR}");
	            params.put("sdtId", sdtId);
	        }
	        this.executeSql(sqlBuilder.toString(), params);		
	}

	@Override
	public void updateTWorkExpInfo(TWorkExpInfo tWorkExpInfo) {
		 String sql = "update t_work_exp_info_drafts  set ";
	        StringBuilder sqlBuilder = new StringBuilder(sql);
	        Map<String, Object> params = new HashMap<String, Object>();
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getUserName())){
	            sqlBuilder.append("  user_name = #{user_name,jdbcType=VARCHAR},");
	            params.put("user_name",tWorkExpInfo.getUserName());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getIdCardNo())){
	            sqlBuilder.append("  id_card_no = #{id_card_no,jdbcType=VARCHAR},");
	            params.put("id_card_no",tWorkExpInfo.getIdCardNo());
	        }
	        if(tWorkExpInfo.getStartDate()!=null){
	            sqlBuilder.append("  start_date = #{start_date,jdbcType=VARCHAR},");
	            params.put("start_date",tWorkExpInfo.getStartDate());
	        }
	        if(tWorkExpInfo.getEndDate()!=null){
	            sqlBuilder.append("  end_date = #{end_date,jdbcType=VARCHAR},");
	            params.put("end_date",tWorkExpInfo.getEndDate());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getCompany())){
	            sqlBuilder.append("  company = #{company,jdbcType=VARCHAR},");
	            params.put("company",tWorkExpInfo.getCompany());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getDept())){
	            sqlBuilder.append("  dept = #{dept,jdbcType=VARCHAR},");
	            params.put("dept",tWorkExpInfo.getDept());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getPost())){
	            sqlBuilder.append("  post = #{post,jdbcType=VARCHAR},");
	            params.put("post",tWorkExpInfo.getPost());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getRank())){
	            sqlBuilder.append("  rank = #{rank,jdbcType=VARCHAR},");
	            params.put("rank",tWorkExpInfo.getRank());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getJobContent())){
	            sqlBuilder.append("  job_content = #{job_content,jdbcType=VARCHAR},");
	            params.put("job_content",tWorkExpInfo.getJobContent());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getPostType())){
	            sqlBuilder.append("  post_type = #{post_type,jdbcType=VARCHAR},");
	            params.put("post_type",tWorkExpInfo.getPostType());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getUpdaterId())){
	            sqlBuilder.append("  updater_id = #{updater_id,jdbcType=VARCHAR},");
	            params.put("updater_id",tWorkExpInfo.getUpdaterId());
	        }
	        if(!StringUtil.isNullOrEmpty(tWorkExpInfo.getUpdaterName())){
	            sqlBuilder.append("  updater_name = #{updater_name,jdbcType=VARCHAR},");
	            params.put("updater_name",tWorkExpInfo.getUpdaterName());
	        }
//	        if(tWorkExpInfo.getUpdateTime()!=null){
	            sqlBuilder.append("  update_time = now() ");
//	            params.put("update_time",new SimpleDateFormat("yyyy-mm-dd hh:mm:ss").format(new Date()));
//	        }
	        sqlBuilder = new StringBuilder(sqlBuilder.substring(0,sqlBuilder.length()-1));
	        sqlBuilder.append(" where 1=1 ");
	        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
	        params.put("id",tWorkExpInfo.getId());

	        this.executeSql(sqlBuilder.toString(),params);
	}

	@Override
	public void updateTRotationInfo(TRotationInfo tRotationInfo) {
		String sql = "update t_rotation_info_drafts set ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder
                .append("start_time=#{start_time,jdbcType=DATE},")
                .append("end_time=#{end_time,jdbcType=DATE},")
                .append("rotation_dept=#{rotation_dept,jdbcType=VARCHAR},")
                .append("rotation_org=#{rotation_org,jdbcType=VARCHAR},")
                .append("rotation_post=#{rotation_post,jdbcType=VARCHAR},")
                .append("updater_id=#{updater_id,jdbcType=VARCHAR},")
                .append("updater_name=#{updater_name,jdbcType=VARCHAR},")
                .append("update_time=now()");
        sqlBuilder.append(" where 1=1 ");
        sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tRotationInfo.getId());
        params.put("start_time", tRotationInfo.getStartTime());
        params.put("end_time", tRotationInfo.getEndTime());
        params.put("rotation_dept", tRotationInfo.getRotationDept());
        params.put("rotation_org", tRotationInfo.getRotationOrg());
        params.put("rotation_post", tRotationInfo.getRotationPost());
        params.put("updater_id", tRotationInfo.getUpdaterId());
        params.put("updater_name", tRotationInfo.getUpdaterName());

        this.executeSql(sqlBuilder.toString(),params);		
	}

	@Override
	public void deleteMes(String businessId, String tabName) {
		String sql = "delete from "+tabName;
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" where ID=#{ID,jdbcType=VARCHAR}");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("ID", businessId);
		this.executeSql(sqlBuilder.toString(), params);		
	}

	@Override
	public void deletePartRankData(String businessId) {
		String sql = "delete from t_part_rank_drafts ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" where item_id=#{item_id,jdbcType=VARCHAR}");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("item_id", businessId);
		this.executeSql(sqlBuilder.toString(), params);			
	}

	@Override
	public IntegrityAnalysisVo integrityAnalysisByTabNameAndErpNo(String tabName, String fax) {
		StringBuilder sqlBuilder = new StringBuilder(
				"select count(*) as count_num FROM "+tabName);
		sqlBuilder.append(" where is_valid=0 and del_sign=0");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (!StringUtil.isNullOrEmpty(fax)) {
			sqlBuilder.append(" and erp_no=? ");
			arrayList.add(fax);
		}
		return this.findUnique(IntegrityAnalysisVo.class, sqlBuilder.toString(), arrayList.toArray());
	}

	@Override
	public IntegrityAnalysisVo integrityAnalysisByTypeAndErpNo(int itemType, String fax,String tabName) {
		StringBuilder sqlBuilder = new StringBuilder(
				"select count(*) as count_num from(");
		sqlBuilder.append(" select a.id from "+tabName+" a inner join t_part_rank b on a.id=b.item_id  ");
		sqlBuilder.append(" where a.is_valid=0 and a.del_sign=0 ");
		ArrayList<Object> arrayList = new ArrayList<Object>();
		if (itemType!=0) {
			sqlBuilder.append(" and b.item_type=? ");
			arrayList.add(itemType);
		}
		if (!StringUtil.isNullOrEmpty(fax)) {
			sqlBuilder.append("  and b.del_sign=0 and b.erp_no=? ");
			arrayList.add(fax);
		}
		sqlBuilder.append(")as e");
		return this.findUnique(IntegrityAnalysisVo.class, sqlBuilder.toString(), arrayList.toArray());
	}

	 //参与人员
    @Override
    public void deleteTPartRankByCondition(String orgId, String itemId) {
        String sql = "delete from t_part_rank_drafts ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append(" where 1=1 ");
        Map<String, Object> params = new HashMap<String, Object>();
        if(StringUtils.isNotBlank(orgId)){
            sqlBuilder.append(" and org_id=#{orgId,jdbcType=VARCHAR}");
            params.put("orgId",orgId);
        }
        if(StringUtils.isNotBlank(itemId)){
            sqlBuilder.append(" and item_id=#{itemId,jdbcType=VARCHAR}");
            params.put("itemId", itemId);
        }
        this.executeSql(sqlBuilder.toString(), params);
    }

	@Override
	public void addDraftsList(DraftsListVo draftsList) {
		String sql = "insert into t_drafts_list (id,business_id,type_id,type_name,dept_id,dept_name,creater_id,creater_name,create_time,updater_id,updater_name,update_time) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{business_id,jdbcType=VARCHAR},")
				.append("#{type_id,jdbcType=VARCHAR},").append("#{type_name,jdbcType=VARCHAR},")
				.append("#{dept_id,jdbcType=VARCHAR},").append("#{dept_name,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", IdGen.uuid());
		params.put("business_id", draftsList.getBusinessId());
		params.put("type_id", draftsList.getTypeId());
		params.put("type_name", draftsList.getTypeName());
		params.put("dept_id", draftsList.getDeptId());
		params.put("dept_name", draftsList.getDeptName());
		params.put("creater_id", draftsList.getCreaterId());
		params.put("creater_name", draftsList.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", draftsList.getUpdaterId());
		params.put("updater_name", draftsList.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		this.executeSql(sqlBuilder.toString(), params);		
	}

	@Override
	public void getDraftsListPage(Page<DraftsListVo> page,String erpNo) {
		String sql = " select id,business_id,type_id,type_name,dept_id,dept_name,creater_id,creater_name,create_time " +
                " from t_drafts_list where 1=1 " ;
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();
        if (!StringUtil.isNullOrEmpty(erpNo)) {
            sqlBuilder.append(" AND creater_id= ? ");
            arrayList.add(erpNo);
        }

		sqlBuilder.append(" order by create_time desc ");
		this.findPageBySql(DraftsListVo.class, sqlBuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void deleteDraftsListByBusinessId(String businessId) {
		String sql = "delete from t_drafts_list ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append(" where 1=1 ");
        Map<String, Object> params = new HashMap<String, Object>();
        sqlBuilder.append(" and business_id=#{business_id,jdbcType=VARCHAR}");
        params.put("business_id", businessId);
        this.executeSql(sqlBuilder.toString(), params);			
	}
	
	
	@Override
	public void addGrowthPlan(TGrowthPlan tGrowthPlan, User user) {
		String sql = "insert into t_growth_plan_drafts (id,erp_no,user_name,dept_id,dept_name,start_date,end_date,future_post,other_case,ascension_situation,job,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},")
				.append("#{user_name,jdbcType=VARCHAR},").append("#{dept_id,jdbcType=VARCHAR},")
				.append("#{dept_name,jdbcType=DATE},").append("#{start_date,jdbcType=DATE},")
				.append("#{end_date,jdbcType=DATE},").append("#{future_post,jdbcType=VARCHAR},").append("#{other_case,jdbcType=VARCHAR},")
				.append("#{ascension_situation,jdbcType=VARCHAR},").append("#{job,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tGrowthPlan.getId());
		params.put("erp_no", tGrowthPlan.getErpNo());
		params.put("user_name", tGrowthPlan.getUserName());
		params.put("dept_id", tGrowthPlan.getDeptId());
		params.put("dept_name", tGrowthPlan.getDeptName());
		params.put("start_date", tGrowthPlan.getStartDate());
		params.put("end_date", tGrowthPlan.getEndDate());
		params.put("future_post", tGrowthPlan.getFuturePost());
		params.put("other_case", tGrowthPlan.getOtherCase());
		params.put("ascension_situation", tGrowthPlan.getAscensionSituation());
		params.put("job", tGrowthPlan.getJob());
		params.put("creater_id", user.getFax());
		params.put("creater_name", user.getName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", user.getFax());
		params.put("updater_name", user.getName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", 0);
		params.put("is_valid", 0);
		this.executeSql(sqlBuilder.toString(), params);		
	}

	@Override
	public void getPersonalPageGrowthPlanByErpNo(Page<TGrowthPlan> page, String erpNo) {
		String sql = "select id,erp_no,user_name,dept_id,dept_name,start_date,end_date,future_post,other_case,ascension_situation,job,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" from t_growth_plan_drafts")
		.append(" where del_sign = '0'")
		.append(" and is_valid='0'");
		
		List<Object> paramList = new ArrayList<Object>();
			if (!StringUtil.isNullOrEmpty(erpNo)) {
				sqlBuilder.append(" AND erp_no= ? ");
				paramList.add(erpNo);
			}
		sqlBuilder.append(" order by update_time desc");
		
		this.findPageBySql(TGrowthPlan.class, sqlBuilder.toString(), page, paramList.toArray());			
	}

	@Override
	public TGrowthPlan getGrowthPlanById(String id) {
		String sql = "select id,erp_no,user_name,dept_id,dept_name,start_date,end_date,future_post,other_case,ascension_situation,job,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" from t_growth_plan_drafts")
		.append(" where del_sign = '0'")
		.append(" and is_valid='0'");
		sqlBuilder.append(" and id=?");
		return this.findUnique(TGrowthPlan.class, sqlBuilder.toString(), new Object[] { id });
	}

	@Override
	public void updateGrowthPlan(TGrowthPlan tGrowthPlan, User user) {
		String sql = "update t_growth_plan_drafts set ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("start_date=#{start_date,jdbcType=DATE},").append("end_date=#{end_date,jdbcType=DATE},")
				.append("future_post=#{future_post,jdbcType=VARCHAR},")
				.append("other_case=#{other_case,jdbcType=VARCHAR},")
				.append("ascension_situation=#{ascension_situation,jdbcType=VARCHAR},")
				.append("job=#{job,jdbcType=VARCHAR},")
				.append("updater_id=#{updater_id,jdbcType=VARCHAR},")
				.append("updater_name=#{updater_name,jdbcType=VARCHAR},").append("update_time=now()");
		sqlBuilder.append(" where 1=1 ");
		sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tGrowthPlan.getId());
		params.put("start_date", tGrowthPlan.getStartDate());
		params.put("end_date", tGrowthPlan.getEndDate());
		params.put("future_post", tGrowthPlan.getFuturePost());
		params.put("other_case", tGrowthPlan.getOtherCase());
		params.put("ascension_situation", tGrowthPlan.getAscensionSituation());
		params.put("job", tGrowthPlan.getJob());
		params.put("updater_id", user.getFax());
		params.put("updater_name", user.getName());
		this.executeSql(sqlBuilder.toString(), params);
	}


	@Override
	public void addEmployeeMobility(TEmployeeMobility employeeMobility,User user) {
		StringBuilder sqlBuilder = new StringBuilder("insert into t_employee_mobility_drafts (id, erp_no, user_name, flow_mode, flow_area, flow_type, begin_time, end_time, org_id, creater_id, creater_name, create_time, updater_id, updater_name, update_time, del_sign, is_valid, audit_state, orignal_id, flow_status, business_type_id, isc_user_id, primitive_id,is_cover) values(");
		sqlBuilder.append("#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},")
				.append("#{user_name,jdbcType=VARCHAR},").append("#{flow_mode,jdbcType=VARCHAR},")
				.append("#{flow_area,jdbcType=VARCHAR},").append("#{flow_type,jdbcType=VARCHAR},")
				.append("#{begin_time,jdbcType=DATE},").append("#{end_time,jdbcType=DATE},")
				.append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},")
				.append("#{orignal_id,jdbcType=VARCHAR},").append("#{flow_status,jdbcType=INTEGER},")
				.append("#{business_type_id,jdbcType=VARCHAR},").append("#{isc_user_id,jdbcType=VARCHAR},")
				.append("#{primitive_id,jdbcType=VARCHAR},").append("#{is_cover,jdbcType=INTEGER})");
		HashMap<String, Object> params = new HashMap<>();
		String erpNo = employeeMobility.getErpNo();
		String userName = employeeMobility.getUserName();
		String orgId = user.getBaseOrgId();
		params.put("id",employeeMobility.getId());
		params.put("erp_no",erpNo);
		params.put("user_name",userName);
		params.put("flow_mode",employeeMobility.getFlowMode());
		params.put("flow_area",employeeMobility.getFlowArea());
		params.put("flow_type",employeeMobility.getFlowType());
		params.put("begin_time",employeeMobility.getBeginTime());
		params.put("end_time",employeeMobility.getEndTime());
		params.put("org_id",orgId);
		params.put("creater_id",erpNo);
		params.put("creater_name",userName);
		params.put("create_time", LocalDateTime.now());
		params.put("updater_id",null);
		params.put("updater_name",null);
		params.put("update_time",null);
		params.put("del_sign",0);
		params.put("is_valid",1);
		params.put("audit_state",employeeMobility.getAuditState());
		params.put("orignal_id",employeeMobility.getOrignalId());
		params.put("flow_status",employeeMobility.getFlowStatus());
		params.put("business_type_id",employeeMobility.getBusinessTypeId());
		params.put("isc_user_id",employeeMobility.getIscUserId());
		params.put("primitive_id",employeeMobility.getPrimitiveId());
		params.put("is_cover",employeeMobility.getIsCover());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void findPageEmployeeMobilityByCondi(Page<TEmployeeMobility> page, TEmployeeMobility employeeMobility) {
		String sql = "  select t.* " + " from t_employee_mobility_drafts t " + " where  1=1 and t.del_sign = '0' ";
		StringBuilder sqlBuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<>();
		if (!StringUtil.isNullOrEmpty(employeeMobility.getErpNo())) {
			sqlBuilder.append(" AND erp_no= ? ");
			arrayList.add(employeeMobility.getErpNo());
		}
		sqlBuilder.append(" order by create_time desc  ");
		this.findPageBySql(TEmployeeMobility.class, sqlBuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public TEmployeeMobility getEmployeeMobilityById(String id) {
		String sql = "select t.*,\n" +
				"GET_DIC('FlowMode',flow_mode) as flow_mode_str,\n" +
				"GET_DIC('FlowArea',flow_area) as flow_area_str,\n" +
				"GET_DIC('FlowType',flow_type) as flow_type_str from t_employee_mobility_drafts t where t.id = ? and t.del_sign = '0'";
		return this.findUnique(TEmployeeMobility.class, sql, id);
	}

	@Override
	public void updateEmployeeMobility(TEmployeeMobility employeeMobility) {
		StringBuilder sqlBuilder = new StringBuilder("update t_employee_mobility_drafts set ");
		sqlBuilder.append("flow_mode = #{flow_mode,jdbcType=VARCHAR},")
				.append("flow_area = #{flow_area,jdbcType=VARCHAR},").append("flow_type = #{flow_type,jdbcType=VARCHAR},")
				.append("begin_time = #{begin_time,jdbcType=DATE},").append("end_time = #{end_time,jdbcType=DATE},")
				.append("updater_id = creater_id,").append("updater_name = creater_name,")
				.append("update_time = #{update_time,jdbcType=DATE} ").append("where id = #{id,jdbcType=VARCHAR}");
		HashMap<String, Object> params = new HashMap<>();
		params.put("id",employeeMobility.getId());
		params.put("flow_mode",employeeMobility.getFlowMode());
		params.put("flow_area",employeeMobility.getFlowArea());
		params.put("flow_type",employeeMobility.getFlowType());
		params.put("begin_time",employeeMobility.getBeginTime());
		params.put("end_time",employeeMobility.getEndTime());
		params.put("update_time",LocalDateTime.now());
		this.executeSql(sqlBuilder.toString(), params);
	}

	/**
	 * 获取技术标准信息
	 * @author pengmengzhi
	 * @param tecStandardInfo
	 * @return List<TRotationInfo>
	 *  */
	@Override
	public void findPageTecStandardInfoByCondi(Page<TTecStandardInfo> page, TTecStandardInfo tecStandardInfo){

		String sql = " select t.*  from t_tec_standard_info_drafts t where 1=1 and t.del_sign = '0' ";
		StringBuilder sqlBuilder = new StringBuilder(sql);

		StringBuilder erp_no_sb = new StringBuilder();

		if (!tecStandardInfo.gettPartRankList().isEmpty()) {
			tecStandardInfo.gettPartRankList().forEach(tPartRank -> {
				if (!StringUtil.isNullOrEmpty(tPartRank.getErpNo())) {
					erp_no_sb.append(",'").append(tPartRank.getErpNo()).append("'");
				}
			});
		}

		if (!StringUtil.isNullOrEmpty(erp_no_sb.toString())) {
			sqlBuilder.append(" AND t.creater_id in ( ").append(erp_no_sb.toString().substring(1)).append(" )");
			// arrayList.add(erp_no_sb.toString().substring(1));
		}
		sqlBuilder.append(" order by update_time desc ");
		this.findPageBySql(TTecStandardInfo.class, sqlBuilder.toString(), page, null);
	}

	@Override
	public void addTecStandardInfo(TTecStandardInfo tecStandardInfo){
		String sql = "insert into t_tec_standard_info_drafts(id,standard_name,standard_type,summary,award_date,part_count,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,post_time) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{standard_name,jdbcType=VARCHAR},")
				.append("#{standard_type,jdbcType=VARCHAR},").append("#{summary,jdbcType=VARCHAR},")
				.append("#{award_date,jdbcType=DATE},").append("#{part_count,jdbcType=VARCHAR},")
				.append("#{org_id,jdbcType=VARCHAR},")
				.append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
				.append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
				.append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
				.append("#{post_time,jdbcType=DATE})");;
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tecStandardInfo.getId());
		params.put("standard_name", tecStandardInfo.getStandardName());
		params.put("standard_type", tecStandardInfo.getStandardType());
		params.put("summary", tecStandardInfo.getSummary());
		params.put("award_date", tecStandardInfo.getAwardDate());
		params.put("part_count", tecStandardInfo.getPartCount());
		params.put("org_id", tecStandardInfo.getOrgId());
		params.put("creater_id", tecStandardInfo.getCreaterId());
		params.put("creater_name", tecStandardInfo.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tecStandardInfo.getUpdaterId());
		params.put("updater_name", tecStandardInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("post_time", tecStandardInfo.getPostTime());

		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TTecStandardInfo getTecStandardInfoById(String id){
		String sql = " select t.*, " + " GET_DIC('tecStandardType',t.standard_type) as standard_type_str "
				+ "  from t_tec_standard_info_drafts t "
				+ " where t.id= ? and t.del_sign = '0' ";
		return this.findUnique(TTecStandardInfo.class, sql, new Object[] { id });
	}

	@Override
	public int updateTecStandardInfo(TTecStandardInfo tecStandardInfo) {
		String sql = "update t_tec_standard_info_drafts set ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("standard_name = #{standard_name,jdbcType=VARCHAR},").append("standard_type = #{standard_type,jdbcType=VARCHAR},")
				.append("summary = #{summary,jdbcType=VARCHAR},").append("award_date = #{award_date,jdbcType=DATE},")
				.append("post_time = #{post_time,jdbcType=DATE},")
				.append("part_count = #{part_count,jdbcType=VARCHAR},").append("updater_id = #{updater_id,jdbcType=VARCHAR},")
				.append("updater_name = #{updater_name,jdbcType=VARCHAR},").append("update_time = now(),").append("part_count = #{part_count,jdbcType=INTEGER} ");
		sqlBuilder.append(" where 1=1 ");
		sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tecStandardInfo.getId());
		params.put("standard_name", tecStandardInfo.getStandardName());
		params.put("standard_type", tecStandardInfo.getStandardType());
		params.put("summary", tecStandardInfo.getSummary());
		params.put("award_date", tecStandardInfo.getAwardDate());
		params.put("post_time", tecStandardInfo.getPostTime());
		params.put("part_count", tecStandardInfo.getPartCount());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tecStandardInfo.getUpdaterId());
		params.put("updater_name", tecStandardInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));

		return this.executeSql(sqlBuilder.toString(), params);
	}
}
